这与(或者更确切地说是后续)有关matplotlib 中共享轴方形子图的新 pythonic 风格? https://stackoverflow.com/questions/13629994/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)
And this is the result:
![enter image description here](https://i.stack.imgur.com/CW3nY.png)
If i comment out the two plt.setp() commands, I get some added white borders:
![enter image description here](https://i.stack.imgur.com/7oqbE.png)
如何使图形看起来像我的第一个结果,但轴像第二个结果一样接触?