sjmgarnier / viridis

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

A color scale with white in the middle? #34

Closed talgalili closed 8 years ago

talgalili commented 8 years ago

Hi there, I love viridis. However, I want some color scale where the middle point gets the black or white color. I couldn't find this between the existing color schemes. Is there one like that which I've missed?

Thanks!

sjmgarnier commented 8 years ago

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

talgalili commented 8 years ago

Thanks @sjmgarnier for the explanation. What you write make sense. My problem is with things like a correlation matrix. I want to show extreme values of high and low correlations, but I also want to ignore correlations which are too close to zero so that they are not significant. What do you think?

sjmgarnier commented 8 years ago

@talgalili I don't see how a color map with a black or white midpoint would help here. Maybe I don't really understand what you're trying to do.

talgalili commented 8 years ago

For example, when using the corrplot package, I want to remove the non-significant correlations - but that would just leave a white background - so the question is what background to use.

https://cran.r-project.org/web/packages/corrplot/vignettes/corrplot-intro.html

image

talgalili commented 8 years ago

Compare the above to this:

library(corrplot) M <- cor(mtcars) corrplot(M, method = "circle", col = viridis::viridis(100))

image

talgalili commented 8 years ago

mmm, maybe this (but it doesn't look so good)

corrplot(M, method = "circle", col = viridis::viridis(100), bg = viridis::viridis(100)[50])

image

Sorry for the multiple comments. I'm done :)

sjmgarnier commented 8 years ago

@talgalili This is not really the right place to look for help. I suggest that you post your question on Stackoverflow instead. You're more likely to get answers there on how to improve the graphical representation of your data. Traditionally, correlation matrices are represented as is, with the value of the correlation in each box, and different text colors to differentiate significant correlations from non-significant ones.

talgalili commented 8 years ago

Thank you for the response. You are right, I'll ask this on SO. Have a great day :)