validate icon indicating copy to clipboard operation
validate copied to clipboard

use plot colors that compensate for colorblindness

Open markvanderloo opened this issue 3 years ago • 7 comments

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.

markvanderloo avatar Jul 08 '21 07:07 markvanderloo

file free to assign me when this needs validation ;)

mbannert avatar Jul 08 '21 07:07 mbannert

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 avatar Jul 08 '21 07:07 edwindj

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

edwindj avatar Jul 08 '21 07:07 edwindj

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

markvanderloo avatar Jul 08 '21 08:07 markvanderloo

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

modche avatar Jul 08 '21 09:07 modche

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"

edwindj avatar Jul 08 '21 09:07 edwindj

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.

markvanderloo avatar Jul 09 '21 06:07 markvanderloo