A very simple example with subplots and imshow seems to have bad default behavior.
import matplotlib.pyplot as plt
import numpy as np
grid = np.random.rand(2, 4)
fig, (ax1, ax2) = plt.subplots(1, 2)
ax1.imshow(grid)
ax1.set_title('damped')
ax2.imshow(grid)
ax2.set_title('undamped')
fig.suptitle('Different types of oscillations', fontsize=16)
plt.tight_layout()
plt.savefig('foo.png')
Result:
Why is the suptitle so high? Do I really have to manually adjust it every time based on the height of the subplots? A hint about what's going on can be seen by commenting the second imshow, though I have no guesses for a solution.
Result:
The figure is the same size, and seemingly the layout and suptitle etc. are determined based on the empty axes.


