divPal: Diverging color palette

View source: R/pal.R

divPalR Documentation

Diverging color palette

Description

Diverging color palette: brown to blue, light colors in the middle, darker at the extremes, good for displaying values in two directions

Usage

divPal(
  n = 100,
  reverse = FALSE,
  alpha = 1,
  rwb = FALSE,
  ryb = FALSE,
  gp = FALSE,
  br = FALSE,
  colors = NULL,
  ...
)

Arguments

n

Number of colors. DEFAULT: 100

reverse

Reverse colors? DEFAULT: FALSE

alpha

Transparency (0=transparent, 1=fully colored). DEFAULT: 1

rwb

Should colors be in red-white-blue instead of brown-blue? DEFAULT: FALSE

ryb

Use red-yellow-blue instead of the default, with "khaki" in the center. DEFAULT: FALSE

gp

Use green-purple instead of the default. DEFAULT: FALSE

br

Use blue-red instead of the default. DEFAULT: FALSE

colors

If not NULL, a color vector used in colorRampPalette. DEFAULT: NULL

...

Further arguments passed to colorRamp

Value

Character string vector with color names

Author(s)

Berry Boessenkool, berry-b@gmx.de, Jan 2016

References

The default palette is originally in 12 shades in the IPCC Assessment Report 5 Chapter 12 Fig 12.22, https://www.ipcc.ch/report/ar5/wg1/.
The green-purple and blue-red palettes are from NYtimes (originally with 8 shades), https://www.nytimes.com/interactive/2017/03/21/climate/how-americans-think-about-climate-change-in-six-maps.html

See Also

showPal, seqPal, catPal, addAlpha, colorRampPalette, package RColorBrewer

Examples

plot(rep(1,12), pch=16, cex=5, col=divPal(12), xaxt="n")
showPal()

berryFunctions documentation built on May 29, 2024, 4:01 a.m.