1、默认我们已经有了python2.7环境,并安装有matplotlib库。先画个线图试试:import matplotlib.pyplot as pltplt.plot([1,2,3,4])plt.ylabel('some numbers')plt.show()

3、除了画线图还可以画点图:import matplotlib.pyplot as pltplt.plot([1,2,3,4], [1,4,9,16], 'ro')#x=[1,2,3,4],y=[1,4,9,16],'ro'表示红色的圆点#axis接收的list参数表示:[xmin, xmax, ymin, ymax]plt.axis([0, 6, 0, 20])#设置x、y轴的长度,x轴为[0,6],y轴为[0,20]plt.show()
