This code
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import AxesGrid
mat0 = [[1, 2], [3, 4], [5, 6], [7, 8]] # 4 rows × 2 columns
mat1 = [[-2, 0, 2, 4], [0, 2, 4, 6]] # 2 rows × 4 columns
fig = plt.figure(figsize=(9, 3))
grid = AxesGrid(fig, 111, nrows_ncols=(1,2),
axes_pad=0.15,
cbar_size="6%", cbar_location="right", cbar_mode="single")
for ax, mat in zip(grid.axes_all, (mat0, mat1)): im = ax.imshow(mat)
grid.cbar_axes[0].colorbar(im)
plt.figure()
plt.imshow(mat0)
plt.colorbar()
plt.show()
produces two Figures
I expected to see, in the first one, a tall rectangle in the left, as in the second Figure.
Of course I'm not understanding what is really happening with AxesGrid.
How can I have the two Images side by side, without the tall one being truncated?
Is an image worth 1000 words?