python绘制折线图示例

来源:互联网 发布:网络高等学历教育 编辑:程序博客网 时间:2024/05/22 10:21

绘制结果:

python代码:

import numpy as npimport pylab as plx = [1, 2, 3, 4, 5]  # Make an array of x valuesy = [1, 4, 9, 16, 25]  # Make an array of y values for each x valuepl.plot(x, y)  # use pylab to plot x and ypl.show()   # show the plot on the screen

Matplotlib是python著名的绘图库,可用来绘制很多高质量的图表,大家可通过其官网给的例程深入学习:http://matplotlib.org/gallery.html

0 0