1.1 Matplotlib简介

Matplotlib是一个非常有用的Python绘图库,它和NumPy结合的很好,但本身是一个单独的开源项目。

*Matplotlib有一些功能函数可以从雅虎财经频道下载并处理数据。

安装:推荐安装Anaconda,其包含Matplotlib

 

官网:http://matplotlib.org/

示例图库:http://matplotlib.org/gallery/index.html

 

“helloworld”: 画一个简单的图形:

#coding:utf-8
'''
__tile__=''
__auther__='Leon'
__mtime__='2017/12/6'
'''
import matplotlib.pyplot as plt


a = [1,2,3,4]
b = [6,6.5,7,9]
#plot导入x/y轴采样点
plt.plot(a,b)
#保存图片
plt.savefig('hello.jpg')
#显示所绘图形
#plt.show()



#y=x^2
x = range(-100,100)
y = [item**2 for item in x]
plt.plot(x,y)

plt.savefig('result.jpg')
#plt.show()


猜你喜欢

转载自blog.csdn.net/luteresa/article/details/78894852
1.1
今日推荐