-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: colorbar for matshow
taller than plot unless using fignum=0
#22972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don;'t know what your fig=0 etc are doing, but the general behaviour is expected that fixed-aspect axes can have colorbars that are too tall (or too wide). Make the aspect ratio of the figure such that the blank space is horizontal instead of vertical. Please see: https://matplotlib.org/3.5.0/gallery/subplots_axes_and_figures/colorbar_placement.html#colorbars-with-fixed-aspect-ratio-axes. I'll close this here, but feel free to discuss at https://discourse.matplotlib.org |
matshow
taller than plot unless using fig=0
matshow
taller than plot unless using fignum=0
Thanks for the reply.
For the record here is the description of the
Since in my example no figure exist beforehand, according to the doc I would expect |
Note that even fignum=0/False won't work for "wide" matrices, e.g. |
Bug summary
When using
plt.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
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
The text was updated successfully, but these errors were encountered: