add_axes(*args, **kwargs)
maplot.figure.Figure.add_axes(Pythonmethod,infigure)
在位置rect[left,bottom,width,height]上增加一個坐標軸
<code>
rect = l,b,w,h
fig.add_axes(rect)
</code>
具有l(wèi)abel參數(shù)可以添加label
<code>
fig.add_axes(rect,label='axes1')
fig.add_axes(rect,label='axes2')
</code>
在少數(shù)情況下,如果一個Axes的實體已經(jīng)被聲明但是沒有加入到figure中刻剥,可以直接使用add_axes將他加入
<code>
fig.add_axes(ax)
</code>
fig.tight_layout()
可以解決標簽重疊問題
<code>
fig, axes = plt.subplots(nrows=1, ncols=2)
for ax in axes:
ax.plot(x, y, 'r')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_title('title')
fig.tight_layout()
fig
</code>
matplot.figure(Python module, in figure)
matplotlib.axes.Axes.twinx(Python method, in matplot.axes.Axes.twinx)
使用同一個x軸,可以用來實現(xiàn)雙坐標軸
例如:
<code>
ax.plot()
ax2.twinx(ax)
</code>