-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
Colorbar
breaks with min limit == max limit
#3174
Comments
what would be the expected output? a colorbar with one color (a categorical cmap)? |
Yes, I was expecting a colormap with just one color and one value. |
colors are interpolated by scaling the colorrange to 0, 1 and mapping that to the colorscheme's colors. If you have a colorrange of width 0, you can't look up any value in the colorscheme |
The error message is not good though |
Maybe, for this corner case, generate a Colorbar with the first color of the color scheme or without color just with the border and the value. Another option would be to display a warning and show an empty Colorbar or display a warning and not show the Colorbar. |
I'm pretty against warnings, they make it hard to let code run automatically, on CI, etc. Often people don't see these warnings and then wonder later why some colorbar is empty. Also I don't really like doing the "next best thing" if behavior is essentially undefined. I'd go for a clearer error here. Errors stop people in their tracks and make them question what they're doing :) |
I agree. A clearer error message seems like the best way to go. |
Code to reproduce the error:
The text was updated successfully, but these errors were encountered: