pal_div_gradient: Diverging colour gradient (continuous).

View source: R/pal-gradient.R

pal_div_gradientR Documentation

Diverging colour gradient (continuous).

Description

Diverging colour gradient (continuous).

Usage

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

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. Must be "Lab" - other values are deprecated.

Examples

x <- seq(-1, 1, length.out = 100)
r <- sqrt(outer(x^2, x^2, "+"))
image(r, col = pal_div_gradient()(seq(0, 1, length.out = 12)))
image(r, col = pal_div_gradient()(seq(0, 1, length.out = 30)))
image(r, col = pal_div_gradient()(seq(0, 1, length.out = 100)))

library(munsell)
pal <- pal_div_gradient(low = mnsl(complement("10R 4/6"), fix = TRUE))
image(r, col = pal(seq(0, 1, length.out = 100)))

scales documentation built on July 4, 2024, 1:11 a.m.