Chapter 10 Colours

10.1 RColorBrewer

  • We have already been setting colours in some of the previous plots using the RColorBrewer package. RColourBrewer contains ready-made colour palettes. We can view all the palettes it contains in one picture like this.

  • We can also filter the picture above to show only palettes friendly to people who are colour blind.

  • And we can create a palette of colours with a specific number of colours like this. Then view them in a simple bar plot.
## Warning in RColorBrewer::brewer.pal(9, "Set2"): n too large, allowed maximum for palette Set2 is 8
## Returning the palette you asked for with that many colors

10.2 Prismatic

  • Prismatic lets us play around with colour palettes by shifting one aspect of all of the colours it contains at the same time. For example, below, we start with the terrain palette in the prismatic package.

  • Now we turn the palette grey.

  • Darken the palette.

  • Make the palette negative.

10.3 Hand-picked colours