Learn R Programming

berryFunctions (version 1.16.0)

divPal: 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 = 12, reverse = FALSE, alpha = 1, rwb = FALSE, ryb = FALSE,
  gp = FALSE, br = FALSE, colors = NULL, ...)

Arguments

n

Number of colors. DEFAULT: 12

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

References

The default palette is originally in 12 shades in the IPCC Assessment Report 5 Chapter 12 Fig 12.22, http://www.ipcc.ch/report/ar5/wg1/. The green-purple and blue-red palettes are from NYtimes (originally with 8 shades), https://nyti.ms/2mL0o4J

See Also

showPal, seqPal, addAlpha, colorRampPalette, package RColorBrewer

Examples

Run this code
# NOT RUN {
plot(rep(1,12), pch=16, cex=5, col=divPal(12), xaxt="n")
showPal()

# }

Run the code above in your browser using DataLab