您的位置:首页 > 编程语言 > PHP开发

Matplotlib--基本画图

2017-10-12 21:40 302 查看
显示图像及画线

import numpy as np
import matplotlib.pyplot as plt

#####################1
x = np.linspace(-5, 5, 30) # X axis data
y = np.sin(x) * x ** 2 + 1

plt.figure()
plt.plot(x, y)
plt.scatter(x, y, c='r')
plt.savefig('d:/f1.png')
plt.figure(2)
plt.bar(x,y, yerr=np.random.normal(0,3, y.shape),width=0.2)
plt.bar(x, y, bottom= y,yerr=np.random.normal(0,3, y.shape), color='y',width=0.2)
plt.savefig('d:/f2.png')
plt.show()





marker options:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  matplotlib