python matplotlib 学习笔记

import numpy as np

x = np.linspace(0, 10, 100)
y1 = np.sin(x)
y2 = np.cos(x)

plt.plot(x, y1)
plt.plot(x, y2)

plt.show()
x = np.arange(0.0, 5.0, 0.02)
y = np.exp(-x) * np.cos(2*np.pi*x)
fig = plt.figure()
ax = fig.add_axes([0.1, 0.1, 0.8,0.8])
ax.grid(linestyle=":", linewidth=2, color='gray')
ax.plot(x, y)
plt.show()

https://matplotlib.org/gallery.html 

猜你喜欢

转载自blog.csdn.net/weixin_39970417/article/details/81205032