Learn R Programming

khroma (version 1.1.1)

colour: Colour palette

Description

Provides qualitative, diverging and sequential colour palettes.

Usage

colour(palette, reverse = FALSE, names = TRUE, ...)

color(palette, reverse = FALSE, names = TRUE, ...)

Arguments

palette

A character string giving the name of the palette to be used (see below).

reverse

A logical scalar specifying if the resulting vector of colours should be reversed.

names

A logical scalar specifying if the names of the colours should be kept in the resulting vector.

...

Further arguments passed to colorRampPalette.

Value

A palette function that when called with a single integer argument (the number of levels) returns a vector of colours.

Paul Tol's Colour Schemes

The following palettes are available (maximum supported colours in brackets):

Qualitative data

bright (7), vibrant (7), muted (9), light (9)

Diverging data

sunset (11), BuRd (9), PRGn (9)

Sequential data

YlOrBr (9), rainbow (23), smooth rainbow (34)

Scientific Colour Schemes

The following palettes are available:

stratigraphy

International Chronostratigraphic Chart

soil

FAO Reference Soil Groups

References

Jones, A., Montanarella, L. & Jones, R. (Ed.) (2005). Soil atlas of Europe. Luxembourg: European Commission, Office for Official Publications of the European Communities. 128 pp. ISBN: 92-894-8120-X.

Tol, Paul (2018). Colour Schemes. SRON. Technical Note No. SRON/EPS/TN/09-002. URL: https://personal.sron.nl/~pault/data/colourschemes.pdf

Commission for the Geological Map of the World

Examples

Run this code
# NOT RUN {
library(scales)

# Paul Tol's colour schemes
## Qualitative data
show_col(colour("bright")(7))
show_col(colour("vibrant")(7))
show_col(colour("muted")(9))
show_col(colour("light")(9))
show_col(colour("rainbow")(14))
show_col(colour("rainbow")(23))
## Diverging data
show_col(colour("sunset")(11))
show_col(colour("BuRd")(9))
show_col(colour("PRGn")(9))
## Sequential data
show_col(colour("YlOrBr")(9))
show_col(colour("smooth rainbow")(34))

# Scientific colour schemes
## Geologic Timescale
show_col(colour("stratigraphy")(175))
## FAO soil reference groups
show_col(colour("soil")(24))
# }

Run the code above in your browser using DataLab