Generally speaking you should not spend time choosing your own color palette as there are many resources for choosing palettes of colors that “work well together” (under a variety of criteria). In R, colors may be chosen individually or as part of a larger palette. We will discuss colors more in this module.


Choosing Individual Colors

Named Colors

You can choose one of the 657 named colors in R (e.g., color="orange4").

R Named Colors

from Greg Gilbert Lab

Hexadecimal Colors

You can choose a color by specifying its hexadecimal code (e.g., color="#CC3300"). Here is a more comprehensive showing of colors by hexadecimal code.

R Named Colors

from visibone.com

Choosing Colors as a Palette

Two simple color-blind-friendly palettes are shown below, with R code to produce a vector with the colors (from cookbook-r).

cbPalette

# The palette with grey:
cbPalette <- c("#999999","#E69F00","#56B4E9","#009E73",
               "#F0E442","#0072B2","#D55E00","#CC79A7")

cbbPalette

# The palette with black:
cbbPalette <- c("#000000","#E69F00","#56B4E9","#009E73",
                "#F0E442","#0072B2","#D55E00","#CC79A7")

Other sources of palettes are listed below: