-
matplotlib.pyplot
模块:位于matplotlib
的顶层,它是一个state-machine environment
。该模块中的很多函数是用于给当前Figure
的当前Axes
添加plot element
,比如line
、text
、image
等。它非常类似于Matlab
的用法。
matplotlib 、 pyplot 、 pylab 的关系:
matplotlib.pyplot
:是matplotlib
的一个module
。它为底层的面向对象接口提供了一个state-machine interface
。这个必要的时候隐式创建Figure
和Axes
,并维护current Figure
和current Axes
pylab
是一个便利的module
,它导入了matplotlib.pyplot
以及numpy
,它只是为了plot
以及math
方便而用。官方文档不推荐使用它。