Learn R Programming

scales (version 0.1.0)

div_gradient_pal: Diverging colour gradient (continous).

Description

Diverging colour gradient (continous).

Usage

div_gradient_pal(low = mnsl("10B 4/6"), mid = mnsl("N 8/0"), high = mnsl("10R 4/6"), space = "Lab")

Arguments

low
colour for low end of gradient.
mid
colour for mid point
high
colour for high end of gradient.
space
colour space in which to calculate gradient. "Lab" usually best unless gradient goes through white.

Examples

Run this code
x <- seq(-1, 1, length = 100)
r <- sqrt(outer(x^2, x^2, "+"))
image(r, col = div_gradient_pal()(seq(0, 1, length = 12)))
image(r, col = div_gradient_pal()(seq(0, 1, length = 30)))
image(r, col = div_gradient_pal()(seq(0, 1, length = 100)))

library(munsell)
image(r, col = div_gradient_pal(low =
mnsl(complement("10R 4/6", fix = TRUE)))(seq(0, 1, length = 100)))

Run the code above in your browser using DataLab