29.1 Theory and implementation

Colour is a complex topic. There has been considerable progress made in our understanding of representing colour, even if that has led to a plethora of systems, be it HCL, HLS, HSV, LAB, LUV, RGB, XYZ or whatever. A valuable reference is Zeileis et al. (2020) and the accompanying R package colorspace.

R software has kept pace, and there are many packages offering colour palettes and ways of creating new ones. There are qualitative palettes for different groups or categories, sequential palettes for different values of the same variable, and diverging palettes for variables with a critical point such as zero between profit and loss. In addition, palettes have been designed to counteract colour blindness. There are R packages for generating colour palettes from images, and even a package with palettes inspired by Wes Anderson movies.

Many software defaults are effective and do not need to be changed. Colour defaults generally do need to be changed, as will be apparent from the examples. The illustrations used are smaller versions of graphics occurring elsewhere in the book.