tectonicr.colors {tectonicr}R 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)

[Package tectonicr version 0.3.2 Index]