sharex=True
和sharey=True
在以下代码中不起作用:
fig, ax = plot.subplots(sharex=True, sharey=True,figsize=(5, 5))
for i in range(1,16):
plot.subplot(4,4,i)
im=plot.contourf(xlon[:],xlat[:],diffrain[i,:,:])
fig.subplots_adjust(right=0.825)
cax = fig.add_axes([0.85, 0.06, 0.035, 0.91])
fig.colorbar(im, cax=cax)
plot.show()
答案 0 :(得分:1)
您将要决定是通过subplot
还是subplots
来创建轴-机器人不能同时通过两者来创建轴。对于这种简单的情况,subplots
应该可以正常工作。
fig, axes = plot.subplots(4,4, sharex=True, sharey=True,figsize=(5, 5))
for i, ax in enumerate(axes.flat):
im=ax.contourf(xlon[:],xlat[:],diffrain[i,:,:])
fig.subplots_adjust(right=0.825)
cax = fig.add_axes([0.85, 0.06, 0.035, 0.91])
fig.colorbar(im, cax=cax)
plot.show()