Matplotlib之调用接口说明
使用Matplotlib
画图,有两种Usage Pattern
(参见API Overview)
- pyplot 一般用于交互模式和简单的通用画图
- object-oriented pyplot 面向对象的画图,更加精细的画图
可以看到
matplot.pyplot.plot
的源码Figure.add_subplot(nrow, ncol, index)
和plt.subplot()
是一致的Figure.add_subplot()和Figure.add_axes()
Figure.add_axes()
是指在画布上增加一个子axes,位置是由[left, bottom, width, height]给定,这四个数是分数,表示在原画布的相对位置;Figure.add_subplot()
也是在画布上增加子axes,但是它是把原画布进行分拆,比如拆分成 2 x 2形式,fig.add_subplot(2,2,1)
, index是这2x2的index
matplotlib usage guide
Usage Guide
matplotlib的组织架构是分层级的(hierarchy)### Axes
axes 表示的画图的一个区域,是一个对象,所有的操作都需要在在这个对象上展开,一个fig(画布)上可以有多个axes对象