Skip to content
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

use plot colors that compensate for colorblindness #147

Open
markvanderloo opened this issue Jul 8, 2021 · 7 comments
Open

use plot colors that compensate for colorblindness #147

markvanderloo opened this issue Jul 8, 2021 · 7 comments

Comments

@markvanderloo
Copy link
Member

The default colors may not be easily distinguishable for people with colorblindness. We should somehow make it easier to choose colors that compensate for that, or perhaps change the defaults.

@mbannert
Copy link

mbannert commented Jul 8, 2021

file free to assign me when this needs validation ;)

@edwindj
Copy link
Member

edwindj commented Jul 8, 2021

Good one:

  • we should provide an option that a user provides their own colors.
  • since R 3.6 there is a set of really good color palletes in grDevices: https://developer.r-project.org/Blog/public/2019/04/01/hcl-based-color-palettes-in-grdevices
  • tricky part: many qualitative palettes (categorical) are notoriously difficult for color blindness, because qualitative palette do not differ in lightness/saturation.
  • therefor in data visualisation often a blue vs red is used instead of green vs red, because these colors are more distinct for most types of color blindness

@edwindj
Copy link
Member

edwindj commented Jul 8, 2021

(so in base R there is hcl.colors and hcl.pals

@markvanderloo
Copy link
Member Author

I used this online colorblindness simulator to simulate colorblindness and copy-pasted the simulations (completely irreproducibly) into some slides. The current colors do not seem too bad in the simulation but I don't feel in the position to judge.

validate-colorblindness.pdf

@modche
Copy link

modche commented Jul 8, 2021

Thanks, nice effort here to have better colours. Have you looked into the Color palette proposed by Okabe and Ito (https://github.com/clauswilke/colorblindr/blob/master/R/palettes.R), implemented in the colorblindr package from @clauswilke. I guess this categorical palette is quite good. However, if you tune the plot output also a width parameter (to have smaller columns for each test with whitespace between) and larger labels would be nice.

image

--Michael

@edwindj
Copy link
Member

edwindj commented Jul 8, 2021

Thanks! The Okabe and Ito palette is also available in grDevices:

palette.colors(palette = "Okabe-Ito")
##         black        orange       skyblue   bluishgreen        yellow 
##     "#000000"     "#E69F00"     "#56B4E9"     "#009E73"     "#F0E442" 
##          blue    vermillion reddishpurple          gray 
##     "#0072B2"     "#D55E00"     "#CC79A7"     "#999999"

@markvanderloo
Copy link
Member Author

How about a black & white option? Matt pointed out on Slack that the current colors are hard to distinguish in low contrast circumstances. R now has the option to shade surfaces in different patterns. I will experiment a little with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants