Visualizing Innovation

Colors

Dr. Matthias Schnetzer

October 30, 2023

All colours are beautiful

Colors in R

You can assign colors by names

  • “red”, “green”, “chocolate”, “cadetblue”, etc.
  • See a complete list of the 657 colors typing colors()
 [1] "white"         "aliceblue"     "antiquewhite"  "antiquewhite1"
 [5] "antiquewhite2" "antiquewhite3" "antiquewhite4" "aquamarine"   
 [9] "aquamarine1"   "aquamarine2"   "aquamarine3"   "aquamarine4"  


Alternatively, you can use hex color codes

Color palettes of {RColorBrewer}

Sequential

Use to encode numerical information with order

Diverging

Use to encode numerical information with critical midpoint

Qualitative

Use to encode categorical information

Color blindness

You may check whether the color scale works for people who can distinguish fewer colours than others with {colorBlindness}.

The viridis color scale is discriminable under the most common forms of colour blindness, and reproduces well in greyscale.

Fancy palettes

Color scales in {ggplot}

scale_color_*
scale_fill_*

Continuous:

  • continuous(type)
  • distiller(palette)
  • gradient(high, low)
  • gradient2(high, mid, low)
  • gradientn(colours)
  • viridis_c(option)

Discrete:

  • manual(values)
  • brewer(palette)
  • grey(start, end)
  • viridis_d(option)

Bibliography

Scherer, Cédric (2022). Graphic design with ggplot2. https://rstudio-conf-2022.github.io/ggplot2-graphic-design/