sjmgarnier / viridis

Colorblind-Friendly Color Maps for R
http://sjmgarnier.github.io/viridis
Other
286 stars 38 forks source link

Add new viscm colormaps #61

Open apcamargo opened 5 years ago

apcamargo commented 5 years ago

Hi @sjmgarnier

I've been using your viridis package for some time and I really appreciate your work in it. I feel, however, that it should include diverging colormaps.

In version 0.9.0, seaborn introduced two new diverging colormaps created with viscm(icefire and vlag). Do you think it would be appropriate to include them into viridis and viridisLite? I can work in a PR.

Additionally, we can discuss the inclusion of the twilight circular colormap (included in matplotlib 3.0) and the mako and rocks sequential colormaps (included in seaborn 0.9.0). All of them were created using viscm.

Thanks!

sjmgarnier commented 5 years ago

@apcamargo This is by design. Besides being colorblind friendly, the color maps included in viridis are meant to be "perceptually-uniform, both in regular form and also when converted to black-and-white". A diverging color map would not be perceptually uniform when converted to black-and-white/gray levels (i.e. the same level of gray would end up representing two different values on each side of the midpoint).

apcamargo commented 5 years ago

@sjmgarnier Thanks for the reply. I understand your point concerning the diverging colormaps, I didn't know that this was a design choice.

What do you think of the inclusion of twilight (circular) and mako/rocket (sequential), though? They're all perceptually-uniform in grayscale.

sjmgarnier commented 5 years ago

@apcamargo twilight goes white-black-white in grayscale: here again the same level of gray ends up representing two different values on each side of the midpoint. Mako looks very similar to viridis and mako to magma, no? Though if they are actually different, sure, we can include them.

sjmgarnier commented 5 years ago

@apcamargo I think maybe a more useful thing to do would be to port viscm to R using Shiny. @njsmith and @stefanv may be able to tell us if someone has already started working on this. If not, we could get this started.

apcamargo commented 5 years ago

@sjmgarnier Having the same level of gray in both ends is precisely the point of this colormap. As a circular colormap, twilight starts and ends on the same color (this happens even in the colored version). It's very useful to represent cyclic data, such as time.

As for mako, it looks quite different from viridis: index

What do you think?

stefanv commented 5 years ago

With diverging colormaps, you probably don't ever want to convert to black-and-white; but if you do, it should go dark-to-light-to-dark (or the other way around). This is by design.

Mako looks quite nice; a bit less vivid than viridis, more of that eerie plasma feeling. And its color delta and colorblind simulation looks good in viscm too.

Anyone who is interested in this topic should make a point of reading Peter Kovesi's paper: https://arxiv.org/pdf/1509.03700.pdf

sjmgarnier commented 5 years ago

@apcamargo Yes, you're right, rocket and mako are different enough now that I look at them side by side on something else than my cell phone. I'm happy including them in viridis (and viridisLite on which viridis is based).

Regarding twilight, I think it doesn't conform with the general philosophy behind viridis. But I get why these color maps can be useful, so this could warrant the creation of a package specifically for circular colormaps. What do you think?

sjmgarnier commented 5 years ago

@stefanv Thanks, will give it a read.