tectonicr.colors: Colors for input variables

View source: R/plotting.R

tectonicr.colorsR Documentation

Colors for input variables

Description

assigns colors to continuous or categorical values for plotting

Usage

tectonicr.colors(
  x,
  n = 10,
  pal = NULL,
  categorical = FALSE,
  na.value = "grey",
  ...
)

Arguments

x

values for color assignment

n

integer. number of colors for continuous colors (i.e. 'categorical = FALSEā€œ).

pal

either a named vector specifying the colors for categorical values, or a color function. If NULL, default colors are RColorBrewer::brewer.pal() (categorical = TRUE) and viridis::viridis() (categorical = FALSE).

categorical

logical.

na.value

color for NA values (categorical).

...

optional arguments passed to palette function

Value

named color vector

Examples

val1 <- c("N", "S", "T", "T", NA)
tectonicr.colors(val1, categorical = TRUE)
tectonicr.colors(val1, pal = stress_colors(), categorical = TRUE)

val2 <- runif(10)
tectonicr.colors(val2, n = 5)

tectonicr documentation built on Sept. 11, 2024, 6:05 p.m.