Matplotlib是一个Python 2D绘图库,能够生成各类硬拷贝格式和跨平台交互式环境的出版物质量数据。Matplotlib可用于Python脚本,Python和IPython shell,Jupyter笔记本,Web应用程序服务器和四个图形用户界面工具包。html
使用 demo:线图shell
import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.ylabel('some ylabel')
plt.show()
复制代码
demo2:饼图bash
>>> import matplotlib.pyplot as plt
>>> labels = 'a','b','c','d'
>>> explode=(0,0,0.2,0)
>>> explode=(0.1,0,0.2,0)
>>> fig1,ax1=plt.subplots()
>>> sizes=[15,30,45,10]
>>> ax1.pie(sizes,explode=explode,labels=labels,autopct='%1.1f%%',shadow=True,startangle=90)
>>> ax1.axis('equal')
>>> plt.show()
复制代码
参考服务器