Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Closed
Milestone
Description
Bug summary
I used layout=compressed to align colorbar and figure, but after I added fig.suptitle the colorbar is not aligned
Actual outcome
If I do not add "fig.suptitle", the colorbar is aligned with the subfigure

importmatplotlib.pyplotaspltimportnumpyasnparr=np.arange(100).reshape((10,10))fig,ax=plt.subplots(ncols=2,figsize=(4,2),layout='compressed')im0=ax[0].imshow(arr)im1=ax[1].imshow(arr)plt.colorbar(im0,ax=ax[0])plt.colorbar(im1,ax=ax[1])plt.show()
If I add "fig.suptitle", the colorbar is slightly longer than the subfigure

import matplotlib.pyplot as pltimport numpy as nparr = np.arange(100).reshape((10, 10))fig, ax = plt.subplots(ncols=2, figsize=(4, 2), layout='compressed')im0 = ax[0].imshow(arr)im1 = ax[1].imshow(arr)plt.colorbar(im0, ax=ax[0])plt.colorbar(im1, ax=ax[1])fig.suptitle('Title')plt.show()Expected outcome
If I do not add "fig.suptitle", the colorbar should still aligned to the subfigure, while added a title above them
Matplotlib Version
3.10.3