How do I choose 4-8 colors in base R for plots that colorblind people will be able to see?
Below is the base R color pallet. Looking for a solution in BASE R without the use of packages.
Base R Color Palette Guide: http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf
Color Palettes for Color Blindness: http://mkweb.bcgsc.ca/colorblind/
Specifically how do I manually create accessible colors in BASE R?
e.g. "vermilion", "bluish green", and "reddish purple" as described in the paper figure below.
The palette shown in the question is also known as the Okabe-Ito palette as suggested by Okabe & Ito (2008). Since version 4.0.0, base R provides a new palette.colors()
where this palette is actually the default:
palette.colors(palette = "Okabe-Ito")
## black orange skyblue bluishgreen yellow
## "#000000" "#E69F00" "#56B4E9" "#009E73" "#F0E442"
## blue vermillion reddishpurple gray
## "#0072B2" "#D55E00" "#CC79A7" "#999999"
Along with this palette, various other qualitative palettes are easily available in base R. Specifically, the new default palette (called "R4"
) has also been designed to be rather robust under color vision deficiencies. See the blog post for further details and the subsequent paper for an overview of the improved color infrastructure in base R since the release of R 4.0.0:
In addition to the qualitative palettes above, base R also has a new function hcl.colors()
since version 3.6.0 that makes many sequential and diverging palettes available that are also robust under color vision deficiencies. It provides approximations (derived using the hue-chroma-luminance color model) to many palettes from ColorBrewer.org, viridis, CARTO colors, Crameri's scientific colors etc. The default is the popular viridis palette. The following blog post provides more details and the paper about the colorspace
package explains more related/underlying work.