-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Adding colorbar changes imshow plot color when vmin is close to vmax #5467
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
Cc: @efiring |
We probably should push the range expansion logic up (down?) into @IamJeffG You might be better performance if you use |
@tacaswell Thanks for the |
@IamJeffG |
@tacaswell Each collection re-normalizes the colormap to its own range of values. So if I was able to do this by setting |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
I still notice the behavior from the issue title ("adding colorbar changes imshow plot color") but I'm not convinced if this behavior is buggy. Let's let this go. Closing. |
Thanks @IamJeffG . Re-reading this, I think I agree. We are in a bit of a bind. If you want a colorbar, the norm must not be singular so our options are to expand the norm or to raise and I think this is a case where expanding is reasonable. Currently if you set the norm to be singular after the colorbar is added it will re-expand itself. |
I can't tell whether this is an intended feature or a bug, so I'm going to run it by the group.
Here, we gave a single pixel, so the entire plot is the same color.
With default jet colormap, that single color is dark blue (the bottom of the jet cmap). So far so good.
Here, observe that since vmin==vmax (effectively), the colorbar defaulted to the midpoint of the colormap, now green. Luckily, the Axes from imshow, containing the data, changed too!
On one hand, I like that the colorbar shows context around the singular value. (I think due to this line.) On the other hand, over in Geopandas we plot patches one-by-one with face_color values from a normalized colormap, but adding this renormalization means the colorbar no longer matches the cmap I passed it.
Thoughts? If you tell me this is intended I'm willing to find a workaround to my use case. (Frankly I'm not 100% sure what I would expect matplotlib to do here instead.) Just wanted to get a second opinion.
The text was updated successfully, but these errors were encountered: