1、Pyplot
大多数Matplotlib实用程序位于pyplot子模块下,并且通常在plt别名下导入:
import matplotlib.pyplot as plt现在,Pyplot软件包可以称为plt。
例如:
在图中从位置(0,0)到位置(6,250)画一条线:
import matplotlib.pyplot as plt
import numpy as np
xpoints = np.array([0, 6])
ypoints = np.array([0, 250])
plt.plot(xpoints, ypoints)
plt.show()Result: