Learn R Programming

khroma (version 1.1.1)

scale_tol_diverging: Paul Tol's diverging colour schemes for ggplot2

Description

Provides diverging colour scales from Paul Tol's Colour Schemes.

Usage

scale_colour_sunset(..., reverse = FALSE, midpoint = 0,
  aesthetics = "colour")

scale_color_sunset(..., reverse = FALSE, midpoint = 0, aesthetics = "colour")

scale_fill_sunset(..., reverse = FALSE, midpoint = 0, aesthetics = "fill")

scale_colour_BuRd(..., reverse = FALSE, midpoint = 0, aesthetics = "colour")

scale_color_BuRd(..., reverse = FALSE, midpoint = 0, aesthetics = "colour")

scale_fill_BuRd(..., reverse = FALSE, midpoint = 0, aesthetics = "fill")

scale_colour_PRGn(..., reverse = FALSE, midpoint = 0, aesthetics = "colour")

scale_color_PRGn(..., reverse = FALSE, midpoint = 0, aesthetics = "colour")

scale_fill_PRGn(..., reverse = FALSE, midpoint = 0, aesthetics = "fill")

Arguments

...

Arguments passed to continuous_scale.

reverse

A logical scalar. Should the resulting vector of colours be reversed?

midpoint

A length-one numeric vector giving the midpoint (in data value) of the diverging scale. Defaults to 0.

aesthetics

A character string or vector of character strings listing the name(s) of the aesthetic(s) that this scale works with.

Details

Diverging colour schemes are linearly interpolated.

Palette Max.
sunset 11
BuRd 9

References

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

See Also

Other Paul Tol's colour schemes: scale_tol_discrete, scale_tol_sequential

Examples

Run this code
# NOT RUN {
library(ggplot2)

# Diverging data
ggplot(economics, aes(psavert, pce, colour = unemploy)) +
  geom_point() +
  khroma::scale_color_sunset(midpoint = 12000)

ggplot(economics, aes(psavert, pce, colour = unemploy)) +
  geom_point() +
  khroma::scale_color_BuRd(midpoint = 9000)

ggplot(economics, aes(psavert, pce, colour = unemploy)) +
  geom_point() +
  khroma::scale_color_PRGn(midpoint = 6000)
# }

Run the code above in your browser using DataLab