Skip to content

Instantly share code, notes, and snippets.

@yaojenkuo
Created April 4, 2020 11:16
Show Gist options
  • Select an option

  • Save yaojenkuo/aa6b352eedea84627eed664b13b2a0be to your computer and use it in GitHub Desktop.

Select an option

Save yaojenkuo/aa6b352eedea84627eed664b13b2a0be to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 2*np.pi)
y = np.sin(x)
fig = plt.figure()
ax = plt.axes()
ax.plot(x, y)
ax.set_title("$y = sin(x)$")
ax.set_xlabel("x")
ax.set_ylabel("y")
ax.set_xticks([0, np.pi, 2*np.pi])
ax.set_xticklabels(['0', '$\pi$', '$2\pi$'])
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment