validate
validate copied to clipboard
use plot colors that compensate for colorblindness
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.
file free to assign me when this needs validation ;)
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
(so in base R there is hcl.colors
and hcl.pals
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.
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.

--Michael
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"
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.