Learn R Programming

broman (version 0.84)

twocolorpal: Create vector of colors from blue to white to red

Description

Create a two-color palette from one color to another through some third color

Usage

twocolorpal(colors = c("slateblue", "white", "violetred"), n = 256, ...)

Value

Vector of colors, from blue to white to red

Arguments

colors

Vector of three colors

n

Number of colors in output.

...

Passed to grDevices::colorRampPalette().

See Also

revgray()

Examples

Run this code
x <- matrix(rnorm(100, 0.5), ncol=10)
mxabs <- max(abs(x))
image(x, col=twocolorpal(), zlim=c(-mxabs, mxabs))

Run the code above in your browser using DataLab