Section 14 Graphics parameter: colour / color
- R Colour can be defined by:
- by colour number: 1 to 7; colour 8 is light grey
- by colour name: e.g. ‘red’ as an element of
colours()
- by a hexadecimal string of the form
#RRGGBB
- by an integer subscript
i
on the currentpalette()[i]
- by package
RColorBrewer
- To see all 657 colors defined by R, type
colours()
14.1 Colour by Number
14.4 Colour by Palette
- Create a vector of
n
contiguous colors using the following functions:- rainbow(n)
- heat.colors(n)
- terrain.colors(n)
- topo.colors(n)
- cm.colors(n)
14.5 Package RColorBrewer
- The package
RColorBrewer
provides a combination of selected colours together into a set of palettes.
