I have four 2D arrays I want to plot in four subplots using imshow. I want the separation between these subplots to be removed, making the subplots touch each other, similar to the Matplotlib Documentation (second to last example). My attempt is
fig, axs = plt.subplots(2, 2, sharex='col', sharey='row', gridspec_kw={'hspace': 0, 'wspace': 0})
(ax1, ax2), (ax3, ax4) = axs
ax1.imshow(im1)
ax2.imshow(im2)
ax3.imshow(im3)
ax4.imshow(im4)
for ax in fig.get_axes():
ax.label_outer()
plt.show()
This produces
The separation in the vertical direction seems to be correctly removed, but I still have a separation in the horizontal direction. Does anyone know how I can get rid of that as well here?