matplotlib 使用

matplotlib

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()
複製代碼

參考服務器

相關文章
相關標籤/搜索