繪圖的推薦途徑是 matplotlib 還是 pylab?
pylab 模組是在一個名稱空間中匯入 matplotlib.pyplot(用於繪圖)和 numpy(用於數學和陣列運算)。
儘管很多示例使用 pylab,但不再建議使用。對於非互動性繪圖,建議使用 pyplot 建立圖形,然後使用面向物件介面繪圖。
示例
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 2, 100)
plt.plot(x, x, label='linear')
plt.plot(x, x**2, label='quadratic')
plt.plot(x, x**3, label='cubic')
plt.xlabel('x label')
plt.ylabel('y label')
plt.title("Simple Plot")
plt.legend()
plt.show()輸出

廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP