spal: Create sequential color palettes using the HCL color space

Description Usage Arguments Value Author(s) See Also Examples

View source: R/spal.R

Description

spal creates sequential color palettes using the HCL color space. Sequential color palettes are composed of a gradient of colors where the gradient can include a range of hues, luminance values, or chroma values. Sequential color palettes are suitable for encoding continuous variables where either low or high values are of importance, but not both.

Usage

1
2
spal(n, hue.start = 235, hue.end = NULL, luminance = c(30, 85),
  chroma = c(90, 100), power = 1, alpha = 1, fixup = TRUE)

Arguments

n

number of colors to create

hue.start

starting hue value, should be in the interval [0, 360]

hue.end

ending hue value, should be in the interval [0, 360].

luminance

vector of length 2 giving the start and end bounds for the range of luminance values

chroma

vector of length 2 giving the start and end bounds for the range of chroma values

power

parameter to control how chroma and luminance increase/decrease

alpha

transparency level defined on the interval [0, 1] where 0 = transparent and 1 = opaque

fixup

logical, should RGB value be corrected (see hcl

Value

spal returns a vector of hex colors

Author(s)

Michael Malick

See Also

hcl qpal dpal

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
plotpal(spal(140))
plotpal(spal(140, luminance = c(20, 80)))
plotpal(spal(140, hue.start = 235, hue.end = 70))
plotpal(spal(140, hue.start = 235, hue.end = 70, luminance = c(20, 80)))

image(t(volcano)[ncol(volcano):1,], col = spal(100))
image(t(volcano)[ncol(volcano):1,], col = spal(100, hue.end = 70))

plotpal(spal(140, power = 0.8))
plotpal(spal(140, power = 1))
plotpal(spal(140, power = 1.3))
plotpal(spal(140, power = 1.5))

plotpal(spal(140, hue.start = 260, chroma = c(80, 0),
    luminance = c(30, 90), power = 1.5))

michaelmalick/r-chroma documentation built on May 22, 2019, 9:51 p.m.