colour | R Documentation |
Provides qualitative, diverging and sequential color schemes.
colour(palette, reverse = FALSE, names = TRUE, lang = "en", force = FALSE, ...)
color(palette, reverse = FALSE, names = TRUE, lang = "en", force = FALSE, ...)
palette |
A |
reverse |
A |
names |
A |
lang |
A |
force |
A |
... |
Further arguments passed to colorRampPalette. |
A palette function with the following attributes, that when called with a single integer argument (the number of levels) returns a (named) vector of colors.
A character
string giving the name of the
color scheme.
A character
string giving the corresponding
data type. One of "qualitative
", "diverging
" or "sequential
".
A logical
scalar: can the color palette be
interpolated?
A character
string giving the the hexadecimal
representation of the color that should be used for NA
values.
An integer
giving the maximum number of color values.
Only relevant for non-interpolated color schemes.
For color schemes that can be interpolated (diverging and sequential data),
the color range can be limited with an additional argument. range
allows
to remove a fraction of the color domain (before being interpolated; see
examples).
The following palettes are available. The maximum number of supported colors is in brackets, this value is only relevant for the qualitative color schemes (divergent and sequential schemes are linearly interpolated).
bright
(7), high contrast
(3), vibrant
(7),
muted
(9), medium contrast
(6), pale
(6), dark
(6), light
(9).
sunset
(11), BuRd
(9), PRGn
(9).
YlOrBr
(9), iridescent
(23), discrete rainbow
(23), smooth rainbow
(34).
According to Paul Tol's technical note, the bright
, highcontrast
,
vibrant
and muted
color schemes are color-blind safe. The
mediumcontrast
color scheme is designed for situations needing color
pairs.
The light
color scheme is reasonably distinct for both normal or
colorblind vision and is intended to fill labeled cells.
The pale
and dark
schemes are not very distinct in either normal or
colorblind vision and should be used as a text background or to highlight
a cell in a table.
Refer to the original document for details about the recommended uses (see references).
As a general rule, ordered data should not be represented using a rainbow scheme. There are three main arguments against such use (Tol 2018):
The spectral order of visible light carries no inherent magnitude message.
Some bands of almost constant hue with sharp transitions between them, can be perceived as jumps in the data.
Color-blind people have difficulty distinguishing some colors of the rainbow.
If such use cannot be avoided, Paul Tol's technical note provides two color schemes that are reasonably clear in color-blind vision. To remain color-blind safe, these two schemes must comply with the following conditions:
discreterainbow
This scheme must not be interpolated.
smoothrainbow
This scheme does not have to be used over the full range.
The following (qualitative) color scheme is available:
okabeito
Up to 8 colors.
okabeito black
Up to 8 colors, with black as the last.
The following (qualitative) color schemes are available:
stratigraphy
International Chronostratigraphic Chart (175 colors).
land
AVHRR Global Land Cover Classification (14 colors).
soil
FAO Reference Soil Groups (24 colors).
N. Frerebeau
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.
Okabe, M. & Ito, K. (2008). Color Universal Design (CUD): How to Make Figures and Presentations That Are Friendly to Colorblind People. URL: https://jfly.uni-koeln.de/color/.
Tol, P. (2021). Colour Schemes. SRON. Technical Note No. SRON/EPS/TN/09-002, issue 3.2. URL: https://personal.sron.nl/~pault/data/colourschemes.pdf
Commission for the Geological Map of the World
Other color palettes:
info()
,
ramp()
,
scale_picker
## Okabe and Ito colour scheme
colour("okabe ito")(8)
plot_scheme(colour("okabe ito")(8))
## Paul Tol's colour schemes
### Qualitative data
plot_scheme(colour("bright")(7))
plot_scheme(colour("high contrast")(3))
plot_scheme(colour("vibrant")(7))
plot_scheme(colour("muted")(9))
plot_scheme(colour("medium contrast")(6))
plot_scheme(colour("pale")(6))
plot_scheme(colour("dark")(6))
plot_scheme(colour("light")(9))
### Diverging data
plot_scheme(colour("sunset")(11))
plot_scheme(colour("BuRd")(9))
plot_scheme(colour("PRGn")(9))
### Sequential data
plot_scheme(colour("YlOrBr")(9))
plot_scheme(colour("iridescent")(23))
plot_scheme(colour("discrete rainbow")(14))
plot_scheme(colour("discrete rainbow")(23))
plot_scheme(colour("smooth rainbow")(34))
## Scientific colour schemes
### Geologic timescale
plot_scheme(colour("stratigraphy")(175))
### AVHRR global land cover classification
plot_scheme(colour("land")(14))
### FAO soil reference groups
plot_scheme(colour("soil")(24))
## Adjust colour levels
PRGn <- colour("PRGn")
plot_scheme(PRGn(9, range = c(0.5, 1)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.