-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Cividis colormap added with short description in whats_new #9871
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
Conversation
The push for viridis and all of our "marketing" has been that it is color-blind friendly. So, I think we are going to need a description of how viridis is deficient and how cividis corrects for that (not in the what's new, but certainly here in the Pull Request discussion). I haven't done a side-by-side comparison yet, but if the differences are slight enough, then maybe we could see this as a patch on viridis? There is so much momentum behind viridis that I would hate to add confusion with another very similar colormap with a very similar name. |
Cividis is actually a corrected version (which is why its name is derived from viridis + cvd), done by simulating viridis as seen by someone with complete red-green colorblindness then ensuring the map had a perceptually uniform change in hue across the length of the colormap and maximizing the lightness change from the left side (lowest values) of the colormap to the right side (highest values). In the below figure, you’ll find an example of the same NanoSIMS image overlaid with a) grayscale, b) viridis, c) viridis as viewed by those with complete red-green colorblindness, and d) cividis. The main advantage of cividis is that it is optimized specifically for viewing with a deuteranomaly/red-green colorblind. It is still useful to have both maps available but the colorblind-friendly option could be attractive to many users. Also, cividis has 2 colors rather than 3 as seen in viridis, which can be preferred in some cases. |
So, viridis is still color-blind friendly, just cividis is "more" friendly? I should note we have several other colormaps that were considered such as "plasma" that were all derived from the same methodology and colorspace. Also, you should add an entry for this colormap in the colormap gallary page (I am having trouble finding it at the moment, though...) |
First thanks a lot for your potential contribution. I think folks around here are very open to new colormaps and to making life easier for the colorblind. But more information would be helpful in assessing if this is really an improvement. Does cividis look just like (d) to the colorblind? I'm not seeing a huge difference between (c) and (d) in terms of something that might cause me to misinterpret the data (I don't think I'm colorblind). Good "mathematical models" of natural phenomena have errorbars in the parameters; are (c) and (d) significantly different within those error bars? As @WeatherGod says above, |
Also, Whats New entries go in the directory: https://github.com/matplotlib/matplotlib/tree/master/doc/users/next_whats_new |
The point is evidently to have a colormap that looks the same to those with and without colorblindness. This seems to me like a reasonable thing to do, though the real need for it may be modest. Comments, @njsmith? |
Yep! It was specifically optimized with colorblindness in mind. And yep, with this map, everyone (with normal/trichromatic color vision, deuteranomaly, and complete red-green colorblindness) sees exactly the same image. When comparing c and d, Cividis has a steeper lightness ramp, allowing the edges of the colormap to be further apart. Viridis is great for those with a color vision deficiency, I am not saying it isn't. I completely agree. This is simply an alternative colormap specifically designed for those with CVD. |
OK, fair enough, I agree there is value in having a colormap that looks the same to more people. 👍 @jamienunez All those build tests need to be fixed. Probably just because you put the WhatsNew in the wrong spot. let us know if you need help wading through that. |
@jamienunez I don't want to go all reviewer 3 on you, but I have some questions :-)
|
An additional point that I just remembered about the development of viridis: we chose to clip the luminance range so that it didn't go from complete black to complete white on the ends. The reason for this was to leave room at the ends so that an image could still be annotated by black (or white) text, markers and/or lines. It seems that cividis sacrifices that for maximum perceptual delta? |
From my point of view grey is usually perfectly acceptable as a non-diverging colormap when perceptual uniformity is desirable. I’ll often use jet when I don’t want perceptual uniformity (horrors!). I too wonder what the perceived advantage of the new colormap is relative to grey. To me the real challenge is a decent looking diverging colormap that is also colourblind friendly. |
Sorry for the delay in answering questions! @njsmith: when you say "complete red-green colorblindness", are you talking about deuteranopia or protanopia? you say that everyone sees exactly the same thing with this colormap, but I don't understand how that's possible with anything except a greyscale colormap... are you claiming that if you take the colormap and run it through your CVD simulation algorithm repeatedly, then nothing changes? (i.e., it's a fixed point of the algorithm?) And furthermore, it's a simultaneous fixed point for all CVD variants? speaking of greyscale colormaps, what advantage do you see this as having over a perceptually uniform greyscale colormap? what algorithm exactly are you using to simulate CVD, and compute color deltas? Machado et al (2009) applied to sRGB and then converting to CAM02-UCS and computing Euclidean distance in that space? In your figure, the perceptual delta curve in panel (c) is not flat, but the deviation from flatness seems small (or perhaps that's an artifact of overly large y-limits?). So far as I know, no-one has ever validated a color delta algorithm on people with CVD, plus there are many variants of CVD, plus CVD simulation algorithms are fairly approximate things, plus CAM02-UCS is itself only an approximation. How confident are you that the difference in perceptual delta curves between panels (c) and (d) is actually real given all of these approximations, and what gives you this confidence? @WeatherGod: @jklymak: If anyone is interested in seeing the paper, please let me know and I'll see what I can do. The paper, of course, can not be shared outside this group since it is still in review. |
Oh and @jklymak, I am changing colormap_reference.py and the correct what's new now. |
@njsmith, to answer your last question (now that a couple colleagues have verified my observations): This can be used as a direct evaluation for comparing the small change in perceptual deltas. Higher delta: better definition. Also, there are some places where the sine waves in the top image don't line up exactly, showing slight changes in perceptual delta. I feel this is a great way of supporting the small perceptual delta difference and the overall method of conversion between spaces. Please let me know what you think! |
The doc-building doesn't like the unicode in your name. Umm, not 100% sure whats to be done about that. Someone smart will:
|
That's okay. Both spellings are fine so I removed it. Hopefully that allows the tests to pass. |
Can someone look into the cause of these tests failing? I can't find the source of the error |
There was a bug introduced by a new version of pytest. Try updating your
copy of the master branch and rebasing your branch on it. Then force-push
to retrigger the tests.
So, my concern at this point is making sure that we put your colormap into
the right context in the description in "what's new". Like I have pointed
out before, by stating that cividis "has been optimized for viewing by
those with or without a color vision deficiency", it begs the question of
"is there something wrong with viridis?" due to all of the advertising of
viridis being colorblind friendly. It would be helpful to know how users
should view cividis in comparison with viridis.
…On Wed, Nov 29, 2017 at 10:41 AM, Jamie Nunez ***@***.***> wrote:
Can someone look into the cause of these tests failing? I can't find the
source of the error
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#9871 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARy-IYN5q-PLd0PLncgWOZfEEcWHKA6ks5s7Xs9gaJpZM4QsYjV>
.
|
e242801
to
07332a1
Compare
That is a great point @WeatherGod. Viridis is 'colorblind friendly’ so your advertising was accurate. However, being ‘colorblind friendly’ does not mean it was fully optimized for CVD. So while it performs much better than nonfriendly colomaps, like rainbow, it still has some drawbacks in the CVD space. People with CVD could perceive the underlying data differently than people without CVD. The goal with cividis was to ensure as-identical-as-possible perception of the data, while maintaining perceptual uniformity and linear lightness. Viridis is still useful since it is more aesthetically pleasing, is still perceptually uniform for noncolorblind individuals, and cycles through three colors which amplifies differences between pixels close in value. Below, I have attached another image that shows the perceived vs true difference between neighboring pixels (values along the white line are plotted). Our paper describes this plot in further detail so we have submitted it to arXiv and I will share the link once it is available. Essentially, these plots show that for people with CVD, some small changes in the underlying data may be represented by a relatively larger change along the colormap (i.e., disproportionate changes), and vice versa. Greyscale and cividis maintain proportional changes throughout (as does viridis, but only for people without CVD). Based on this, what would be the best way to word this in the “what’s new” file? I could change it to the following: “cividis is a new perceptually uniform colormap with linear lightness, which maintains proportionate perception for both people with and without colorblindness (CVD).“ |
travis CI had some sort of problem.... I'm still not quite following why viridis doesn't have the same perceptual deltas for colorblind viewers. I still suspect its a difference in the models used to simulate colorblindness. W/o a parameter study, i.e. where you make a cloud of such plots by Monte Carlo changing the model parameters over some reasonable range, I am not clear if the differences in your plot above are significant or not. I don't mind this going in because it looks the same for colorblind and non-colorblind viewers (within any model uncertaintties), and that seems useful. But it would be educational to know what the difference in models is, particularly before you claim yours "corrects" viridis. |
@jklymak: Edit: I understand now what you mean by the need for a parameter study! Sorry about the misunderstanding. This is something my team should indeed look into so we will try to do so soon. I'll let you all know what we find. |
@@ -3,3 +3,9 @@ New style colorblind-friendly color cycle | |||
|
|||
A new style defining a color cycle has been added, tableau-colorblind10, to provide another option for | |||
colorblind-friendly plots. | |||
|
|||
Cividis colormap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change should get its own file, not be put in its own.
it'd be cool if you included a plot in here so people could see what it looks like...
.. plot::
import matplotlib.pyplot
import numpy as np
fig, ax = plt.subplots()
pcm = ax.pcolormesh(np.rand.random(32,32), cmap='cividis')
fig.colorbar(pcm)
Cividis colormap | ||
---------------------------- | ||
|
||
A new colormap, named cividis, has been optimized for viewing by those with or without a color vision deficiency. For more information, please see our paper (to be published in 2018) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...has been optimized so that it looks similar to people with or...
I should say, I think it's super cool that you're working on this, and I hope my comments aren't discouraging – if one of the outcomes of the viridis work is that people are thinking about colormaps more thoughtfully and critically, then that's awesome. My main concern is that since there's so much confusion out there about colors, matplotlib should be very careful about exactly what we communicate and what recommendations we make. In particular, a statement like "colormap X has advantages for CVD users" can easily lose all nuance and then turn into a bludgeon people use on each other, so we should be careful not to make such statements unless we can clearly explain why we think that and what the trade-offs are.
Yeah, the reason this jumped out at me is that I also managed to confuse myself about this at one point :-). I do think you should be making a habit of including CVD-cividis in any comparison images/graphs. Comparing CVD-viridis to non-CVD cividis is conceptually the wrong thing, and this would let you demonstrate the similarity between non-CVD cividis and CVD-cividis instead of just asserting it.
I see what you're trying to say, but this summary is pretty misleading. Humans can distinguish millions of colors, sure, but we're not putting millions of colors in any single colormap. (Not even jet does that :-).) A colormap is a 1-dimensional line drawn through a 3-d volume; it's not the size of the volume that matters, it's the length of the line. When you use viscm to examine a colormap, one of the things it calculates is its arc-length (in CAM02-UCS). The idea is that this hopefully gives some clue about how much sensitivity the colormap has – longer colormaps ought to let users make finer discriminations. (This number out to be somewhat misleading for reasons I'll discuss below, but it's the best quantitative measure we have for this.) When I put cividis into viscm, It reports an arc-length of 99.5. For comparison, a perceptually uniform ramp from black→white has length 100.0 on the same scale (and viridis has length 123.9), so CAM02-UCS is claiming that cividis and greyscale actually have almost identical sensitivities. And unfortunately, as I said above, there's actually a good reason not to trust CAM02-UCS here. As Kovesi points out in his colormaps paper, the human perception experiments used to calibrate CAM02-UCS and similar scales use large flat patches of color (low spatial frequency), while colormaps are generally used to display data with high-spatial frequency. At high spatial frequencies the visual system shifts its emphasis more towards the lightness channel and away from hue/saturation. So using CAM02-UCS to estimate colormap sensitivity will tend to be biased, in that it will underestimate the size of lightness changes, and overestimate the size of hue/saturation changes. Since cividis has more hue/saturation variation than greyscale, this means that our estimate above is overestimating the sensitivity of cividis and/or underestimating the sensitivity of black→white. (This also matches our experience designing colormaps: we made various attempts to maximize arclength by using huge movements in the a'b' plane, and this gives colormaps that sound great on paper, but when we tried using them for real images they really weren't any better at resolving fine features than greyscale was. We found this very confusing until we read Kovesi's paper! It's kind of depressing: we have all this awesome color theory and color technology, yet at the end of the day, apparently the main benefit of using non-grey colors is that they're pretty and people like them, and mostly what all the theory does is help us design pretty maps that aren't worse than greyscale. But so it goes...) Anyway, what I take from this is that compared to cividis, a perceptually uniform greyscale map using the whole black→white range actually (a) gives better sensitivity, (b) handles black/white printing better (by definition), (c) does an even better job of looking the same to users with CVD. This doesn't necessarily mean cividis is useless or shouldn't be included in matplotlib – it seems like a reasonable black→yellowish map, and it's great to have more options for colorblind users. But if we want the docs to say "We think cividis is the best choice in the following situations: ____" then I'm having trouble thinking of ways to fill in the blank.
I'm really struggling to see consistent differences between these two images. This is way ambitious for this PR :-), but it'd be really interesting someday to do a double-blind study to see how well these colormaps actually work for real people and real equipment, instead of just trusting the computational models. Maybe one could show people Kovesi's test image and ask them to annotate how far down each line seems to go on their monitor, then compare the places where they click between different colormaps and for folks with or without CVD.
I think that's saying that the ñ in the file was encoded using Latin-1. Sphinx is probably expecting UTF-8 – most things do, these days. Possibly your editor needs to have some setting tweaked to use UTF-8? |
|
||
A new colormap, named cividis, has been optimized so that it looks similar to people with a red-green color vision deficiency. For more information, please see our paper (to be published in 2018). | ||
|
||
plot:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be . plot::
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just updated. Is the change I applied what you had meant?
@njsmith: thank you very much for your feedback and comments! You make really great points, such as how cividis may actually compare grayscale. My team and I will look into addressing these, along with the parameter sweep, soon. Is there anything else I need to do at this point for cividis in matplotlib? |
Cividis colormap | ||
---------------------------- | ||
|
||
A new colormap, named cividis, has been optimized so that it looks similar to people with a red-green color vision deficiency. For more information, please see our paper (to be published in 2018). plot:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No its a plot directive:
https://matplotlib.org/devel/documenting_mpl.html#module-matplotlib.sphinxext.plot_directive
Sorry, I mistyped. Its two periods:
.. plot::
import matplotlib.pyplot
import numpy as np
@jamienunez Is it OK to push to your branch directly? You've got |
Okay I made the change and added plt as the name for matplotlib.pyplot And yep, no worries if you want to make edits yourself! I'm fine with changes being made either way. |
Just to make sure I understood a comment you made earlier about our
feedback, are you planning on possibly updating the cividis colormap, or is
this the final form? We have a very strict policy of not making changes to
things like this, so once it is in matplotlib, that's it. Any updates would
have to made as a brand new colormap with a new name.
…On Wed, Dec 6, 2017 at 11:54 AM, Jamie Nunez ***@***.***> wrote:
Okay I made the change and added plt as the name for matplotlib.pyplot
And yep, no worries if you want to make edits yourself! I'm fine with
changes being made either way.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#9871 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARy-JPHBro8x48jiKU-YsCH_qE0EMTZks5s9sbZgaJpZM4QsYjV>
.
|
Cividis colormap | ||
---------------------------- | ||
|
||
A new colormap, named cividis, has been optimized so that it looks similar to people with a red-green color vision deficiency. For more information, please see our paper (to be published in 2018). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This now renders fine. https://4348-1385122-gh.circle-artifacts.com/0/home/circleci/project/doc/build/html/users/next_whats_new/2017-12-05_cividis_colormap.html
... but, "please see our paper" is too mysterious! "Our paper" will typically mean Matplotlib's paper, and this has no way of knowing what paper you mean.
If we do merge cividis, then I suggest phrasing like: "A new black/yellow colormap named 'cividis' was added. Like viridis, cividis is perceptually uniform and colorblind friendly. However, cividis also goes a step further: not only is it usable by colorblind users, it should actually look effectively identical to colorblind and non-colorblind users. For more details, see Nuñez J, Anderton C, and Renslow R. (submitted). Optimizing colormaps with consideration for color vision deficiency to enable accurate interpretation of scientific data." |
@jamienunez You know, I was thinking about this more today, and it occurred to me that it might not actually be too hard to directly design colormaps with the constraint that they remain invariant under (simulated) CVD. The matrices that implement the Machado et al transform have a well-defined invariant 2d subspace: In [4]: np.linalg.eig(colorspacious.machado_et_al_2009_matrix("deuteranomaly", 100))
Out[4]:
(array([ 5.73655225e-07, 1.00869758e+00, 1.00000585e+00]),
array([[ 0.92205474, -0.64899895, 0.5774051 ],
[-0.38601936, -0.60561839, 0.57737375],
[ 0.02835681, -0.4604636 , 0.57727195]])) notice that the 2nd and 3rd eigenvalues are essentially 1, meaning that the plane spanned by their corresponding eigenvectors is invariant under this transformation. The 3rd eigenvector is all-constant; that's the greyscales. The 2nd eigenvector What about other forms of CVD? In the Machado et al model, all degrees of deuteranomaly have the same invariant subspace as full deuteranopia: In [5]: np.linalg.eig(colorspacious.machado_et_al_2009_matrix("deuteranomaly", 50))
Out[5]:
(array([ 0.30808704, 1.00428102, 1.00000394]),
array([[ 0.93252489, -0.64852155, 0.5774164 ],
[-0.35994545, -0.60532024, 0.57737901],
[ 0.02892397, -0.46152703, 0.57725539]])) Protanopes have a slightly different 2nd eigenvector, but it's close: In [6]: np.linalg.eig(colorspacious.machado_et_al_2009_matrix("protanomaly", 100))
Out[6]:
(array([ -1.44236937e-07, 9.90565816e-01, 9.99999328e-01]),
array([[ 0.98961055, -0.62410276, 0.57735461],
[-0.14374425, -0.59549249, 0.57735172],
[-0.00292275, -0.50585022, 0.57734448]])) So one could just compromise between them, or just use the deuteranopia one since it's more common. I'm not sure how helpful this is – for all I know you're at the point where you've written the paper and just want to move on, and it's anti-helpful. (Sorry!) But if you want to talk more about this then we could switch to email or something instead of cluttering up this PR. |
@WeatherGod: We aren't planning to change cividis but, just in case, we can wait to add it to matplotlib when our paper has been published. It's very unlikely to change after that point. We anticipate reviewer comments on the paper before the end of the year. |
I am making an executive decision and merging this for the 2.2RC1. @jamienunez If you want to tweak the colors, we can do that before 2.2 final release (likely in a week or two). |
Thank you! |
Short description: The main advantage of the cividis colormap over others already available is it was optimized specifically with color vision deficiencies in mind. While it is optimized for complete red-green colorblindness and normal color vision, it is also a great colormap for the other deficiencies. This colormap has already been accepted by software packages such as COMSOL, Fiji, and Plotly.
More information will be available in 2018 when our paper is published: Nuñez J, Anderton C, and Renslow R. Optimizing colormaps with consideration for color vision deficiency to enable accurate interpretation of scientific data.
Quick visual and further explanation: http://forum.imagej.net/t/new-lut-for-fiji-cividis/7467
PR Summary
PR Checklist