palette_timeline: Make an HCL palette for visualizing a linear sequence of...

View source: R/palette.R

palette_timelineR Documentation

Make an HCL palette for visualizing a linear sequence of distributions

Description

This function generates an HCL palette for visualizing a linear sequence of distributions (e.g., a series of utilization distributions describing space use by an individual animal across each of 20 consecutive days or a series of species distributions describing projected responses to global warming in 0.5 C increments).

Usage

palette_timeline(x, start_hue = -130, clockwise = FALSE)

Arguments

x

RasterStack or integer describing the number of layers for which colors need to be generated.

start_hue

integer between -360 and 360 representing the starting hue in the color wheel. For further details, consult the documentation for colorspace::rainbow_hcl. Recommended values are -130 ("blue-pink-yellow" palette) and 50 ("yellow-green-blue" palette).

clockwise

logical indicating which direction to move around an HCL color wheel. When clockwise = FALSE the ending hue will be start_hue + 180. When clockwise = TRUE the ending hue will be start_hue - 180. The default value clockwise = FALSE will yield a "blue-pink-yellow" palette when start_hue = -130, while clockwise = TRUE will yield a "blue-green-yellow" palette.

Value

A data frame with three columns:

  • layer_id: integer identifying the layer containing the maximum intensity value; mapped to hue.

  • specificity: the degree to which intensity values are unevenly distributed across layers; mapped to chroma.

  • color: the hexadecimal color associated with the given layer and specificity values.

See Also

palette_timecycle for cyclical sequences of distributions and palette_set for unordered sets of distributions.

Other palette: palette_set(), palette_timecycle()

Examples

# load fisher data
data(fisher_ud)

# generate hcl color palette
pal_a <- palette_timeline(fisher_ud)
head(pal_a)

# use a clockwise palette
pal_b <- palette_timeline(fisher_ud, clockwise = TRUE)

# try a different starting hue
pal_c <- palette_timeline(fisher_ud, start = 50)

# visualize the palette in HCL space  with colorspace::hclplot
library(colorspace)
hclplot(pal_a[pal_a$specificity == 100, ]$color)
hclplot(pal_b[pal_b$specificity == 100, ]$color)
hclplot(pal_c[pal_c$specificity == 100, ]$color)

colorist documentation built on May 29, 2024, 4:45 a.m.