【发布时间】:2014-05-01 16:39:32
【问题描述】:
这与new pythonic style for shared axes square subplots in matplotlib? 相关(或者说是后续行动)。
我想让子图共享一个轴,就像上面链接的问题一样。但是,我也希望地块之间没有空间。这是我的代码的相关部分:
f, (ax1, ax2) = plt.subplots(1, 2, sharex=True, sharey=True)
plt.setp(ax1, aspect=1.0, adjustable='box-forced')
plt.setp(ax2, aspect=1.0, adjustable='box-forced')
# Plot 1
ax1.matshow(pixels1, interpolation="bicubic", cmap="jet")
ax1.set_xlim((0,500))
ax1.set_ylim((0,500))
# Plot 2
ax2.matshow(pixels2, interpolation="bicubic", cmap="jet")
ax2.set_xlim((0,500))
ax2.set_ylim((0,500))
f.subplots_adjust(wspace=0)
结果如下:
如果我注释掉两个 plt.setp() 命令,我会添加一些白色边框:
如何使图形看起来像我的第一个结果,但轴的接触却像第二个结果一样?
【问题讨论】:
标签: python matplotlib