Learn R Programming

berryFunctions (version 1.11.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, 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
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

Originally in 12 shades in the IPCC Assesment Report 5 Chapter 12 Fig 12.22, http://www.ipcc.ch/report/ar5/wg1/

See Also

showPal, seqPal, addAlpha, colorRampPalette, package RColorBrewer

Examples

Run this code

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

Run the code above in your browser using DataLab