-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Changing default HoloViews colormap #3500
Comments
+1, this makes sense to me. Either that or change the default cmap? |
I thought we already had an issue about various problems with the default colormap, but I was unable to find it by searching for "colormap" or "default" or "hot". (ETA: I think it was #2487.) From what I remember, there were many reasons to change HoloViews' original default "hot" colormap, given that the default page color is typically white for Jupyter notebooks:
Possible improvements:
Colormaps |
I like RdYlBu_r, but it probably has its own issues with that being the default |
RdYlBu is a diverging colormap (see http://holoviews.org/user_guide/Colormaps.html), which is useful for plots with a well defined central value (e.g. deviations around a mean, or positive and negative values). Those conditions occur often, but much more often a sequential colormap is appropriate, so I think the default needs to be sequential. |
Thanks for this detailed post @jbednar ! Personally I like |
I put together a simple notebook with examples of data plotted against the default white background, which is what matters for the default colormap: https://anaconda.org/jbednar/hv_colormap/notebook In each one, notice how some data disappears if the colormap includes white (e.g. from the heatmaps in the bottom left of each figure, for fire and gray maps), and also notice how the peak data is more intuitive and perceptible if the largest value color is most different from white. For each one, I've listed which of the above problems 1-5 it has, out of 1-nonuniform, 2-nan=peak, 3-invertedsalience, 4-blackdata, 5-invertedfromfamiliar viridis: 3-invertedsalience |
To me, viridis and viridis-like colors are problematic because matplotlib defaults to the non-reversed version, where the largest values are those most similar to the background. Because people expect viridis to be in this order, even though it's incorrect for a white background as can be seen above (e.g. in the hextiles), I think we should choose a different one. Same goes for fire and related maps -- people expect them to be in the non-reversed order, which is even worse for fire because the non-reversed one actually represents the color sequence from black-body radiation, and thus reversing it is very odd (with higher values corresponding to lower-temperature colors, confusingly). Gray can be in any order, but it's always going to overlap in color with plot elements (axes, annotations, etc.) unless we limit to a very small range of medium grays, which will limit dynamic range. So my own vote, grudgingly, is for kbc_r, which fits all the criteria but #4, because I don't think it has any natural preferred order that people expect. For #4, it actually doesn't quite include black; the darkest color is the very dark blue "#00004e", which is (barely) distinguishable from black: If we really want true black to be fully distinguishable from the highest value, we could lose the top couple of color values, though that would be a bit confusing because it would no longer be the standard 256 colors in length. |
BTW, I just watched a live talk where someone used Viridis in the wrong order, which applies to almost every use of viridis I see. On a white page, the default ordering is only ever correct for plots with no background visible, which happens but is relatively rare. |
Spacey, I love it! Anyway, I can confirm; I used |
Right; people's expectations are a big problem. Viridis (like the other 3 main mpl uniform colormaps) is totally in the right order for a black background; the problem is just that Jupyter and PDF backgrounds are nearly always white, giving very unsuitable results. BTW, anyone can propose another possible colormap here, and I'll run that notebook on it (or you can run it yourself and paste the resulting .png). |
I think fighting against people's expectations is potentially very problematic. It's definitely inarguable that non-reversed colormaps against a white background are problematic because it makes it hard to distinguish them from the background, but I also definitely wouldn't say they are wrong. The possibility that people will completely confuse the upper and lower bound, is imo something that we should not discount and has potentially much greater implications for misinterpreting data. People are used to dark to light color scales, for better or for worse, and I'm still severely hesitant using a default that subverts those expectations. |
Somehow all of science seems to have gotten confused, but I am very reluctant to go along with their confusion. I'm embarrassed on behalf of scientists everywhere! I do very strongly assert that non-reversed colormaps are in fact wrong (incorrect and inappropriate) to use against a white background, because (a) people have to fight their own visual systems to interpret them correctly, and (b) people have a large danger of missing the most salient values, and (c) such plots only work at all because of properties of typical data, which makes them fall down for atypical data and outliers. Consider kbc vs. kbc_r, for this plot of a 2D normal distribution on a white background:
Given all this, why would anyone ever use kbc_r or other similar colormaps against white? Well, (a) because it's the default (currently completely inappropriately but perhaps appropriately back when people used black-background monitors and presentation slides), and (b) they can still see the shape of the high-count regions because of the typically normal distribution of data values -- gradual shift from low counts to high counts, with high counts clustered spatially. I.e., it's possible to get an understanding of the data out of the "wrong" plot, but it's a very dangerous thing to do, because any of the less-common cases above could occur without anyone realizing it. The point of a visualization is to reveal the data, not to paint a picture of what you already expect based on previous typical examples. If a visualization reveals the typical case ok but is completely misleading in atypical cases, it's a demonstrably incorrect thing to do, if there's another alternative that doesn't have that problem. As shown above, reversing viridis or fire would fix the problem, but causes another problem with people's now completely trained bogus expectations. I don't think kbc suffers from those expectations; as a less familiar colormap, I think people will look at the colorbar if they are confused. |
Turns out it's easy enough to demonstrate problems 3 and 4 directly, by moving all the points near 0,0 by -2, -2:
Fun game -- try to spot the outlier at -2,-2, which at a count of 25 should be the highest value in this plot. Same goes for the hole at 0,0. Still think it's ok to use kbc or similarly inappropriate maps like viridis and fire, when the white background is visible? With kbc_r you can immediately tell that the distribution has been doctored like this. With kbc, who's to know? |
And of course the opposite is true for a black background, with kbc being the one to convey it accurately:
|
Plus, the problems don't get any better with more data, as there will always be some edge of the data that becomes ambiguous:
|
As discussed in #4567, there are now many reasons to change the default colormap. I'm again convinced by my diatribe above that kbc_r is our best option for a colormap. It's perceptually uniform, appropriate for a white background, is not typically used widely and thus has no expected ordering, is completely different from the default so that people cannot fail to notice the change (compared to just flipping the fire order and deleting white), is compatible with the other default colors in HoloViews, is already the default in hvPlot, and looks pretty good to me. What does it take to make it the default? Presumably copy kbc to holoviews/plotting/util.py alongside fire, add kbc_r, and update these references?
|
Default was changed to kbc_r in HoloViews 1.14.0. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Since the default cmap's highest value is white, it's hard to tell if the white values are the max or NaN without hover (and most colormaps used do not use gray?)
The text was updated successfully, but these errors were encountered: