Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Description
Bug summary
When usingplt.colorbar
along withplt.matshow
, the colorbar is taller than the plot. If I useplt.matshow(A, fig=0)
, then it is the same height as the plot.
Code for reproduction
# Basically https://matplotlib.org/stable/gallery/images_contours_and_fields/matshow.html#sphx-glr-gallery-images-contours-and-fields-matshow-py with a colorbar addedimportmatplotlib.pyplotaspltimportnumpyasnp# a 2D array with linearly increasing values on the diagonala=np.diag(range(15))plt.matshow(a)# this triggers the bug# plt.matshow(a, fignum=None) # this too# plt.matshow(a, fignum=1) # this too# plt.matshow(a, fignum=False) # this triggers the expected outcome# plt.matshow(a, fignum=0) # this tooplt.colorbar()plt.show()
Actual outcome
Expected outcome
Additional information
No response
Operating system
Ubuntu 20.04
Matplotlib Version
3.5.2
Matplotlib Backend
QtAgg
Python version
Python 3.10.4
Jupyter version
none involved
Installation
conda
Metadata
Metadata
Assignees
Labels
No labels