R Tips

Home

Contact

Steven Holland

Colors

10 September 2013; updated 5 August 2023

The colors() function reveals a rich palette of named colors in R, but what you really need is to see all of the colors and their names. The r-charts website has a great page showing all the named colors in R. This is also a great site for easy recipes for customizing plots and for getting inspired for making effective plots. link does just that:

Color blindness is a real problem especially among men, where an estimated 7–10% suffer from red-green colorblindness. At this rate, once you have 7–10 men in a room, it is more likely than not that at least one of them is color blind. This poses a challenge for creating accessible plots.

The R package colorBlindness can simulate the effects of color blindness on any color palette, and it also provides several palettes that are safe to use (thanks, Claire!). The viridis package also provides several widely used palettes that are easy to read by people with color blindness. R’s functions palette.colors() and hcl.colors() also improve on the original color palette while making the colors more accessible to those that are color blind; here&rsquo's a good description of them.