绘制曲线

 1 import matplotlib.pyplot as plt 
 2 #准备x y
 3 x = range(-100,100)
 4 y = [i**2 for i in x]
 5 #绘制一元二次方程曲线
 6 plt.plot(x,y)
 7 #保存图片
 8 #plt.savefig('result') #默认格式:png
 9 plt.savefig('result.jpg')
10 plt.show()

 

 

 

posted @ 2020-04-06 15:29  小他_W  阅读(353)  评论(0编辑  收藏  举报