-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: setting norm for imshow
and not using a colorbar produces error
#28555
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
There was some logic added to |
Yeah, I also strongly suspect we are getting saved by the "make-non-singular" logic in the color bar. Looking at the code setting the min to the max of the data and vica versa looks like a typo? |
There is a typo in the vmin that should be min(data) in the example. Although it is unfortunate that this errors with/without a colorbar. The colorbar swaps the vmin and vmax for a user through the nonsingular call expansion I think (on mobile and can't verify) which saves this case for the user. |
Ops, indeed a typo in min/max. -> Fixed for the example. Should the norm itself check that |
We allow other limits to be flipped (eg set_ylim(100, 0) will invert the yaxis). Flipping the limits for the norm is not an unreasonable thing to do, so instead of doing |
Yes we do this for axis limits. The point is that, we currently do not flip the colorbar, but silently exchange min/max in the background. Changing to Note that |
Bug summary
I tried removing the colorbar call from @timhoffm's new example at #28546, and I got an error
Code for reproduction
Actual outcome
With QtAgg:
With TkAgg:
Expected outcome
No error
Additional information
Everything is fine if I add a colorbar.
Operating system
Ubuntu
Matplotlib Version
main
, 3.8.4, 3.6.3Matplotlib Backend
QtAgg and TkAgg
Python version
3.9.19, 3.12.3, 3.11.6
Jupyter version
N/A
Installation
conda
The text was updated successfully, but these errors were encountered: