绘制曲线

 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()

正是江南好风景
原文地址:https://www.cnblogs.com/monsterhy123/p/12642308.html