cpal: Color Palettes

View source: R/plot.R

cpalR Documentation

Color Palettes

Description

These functions provide simple color palettes.

Usage

## Continuous color palettes
cpal(palette = "Viridis")

## Discrete color palettes
dpal(palette = "Tableau 10")

# Add transparency to colors
add_alpha(colors, alpha = 1, exp = 2)

Arguments

palette

The name of a color palette. See palette.pals and hcl.pals.

colors

A character vector of colors to add transparency to.

alpha

A numeric vector giving the level of transparency in the range [0, 1] where 0 is fully transparent and 1 is fully opaque.

exp

The power scaling of the alpha channel. A linear alpha scale often results in poor interpretability for superposed images, so raising the alpha channel (already in range [0, 1]) to a power > 1 can improve interpretability in these cases.

Value

A character vector of colors or a function for generating n colors.

Author(s)

Kylie A. Bemis

See Also

vizi, image

Examples

f <- cpal("viridis")
cols <- f(10)
add_alpha(cols, 1:10/10)

kuwisdelu/matter documentation built on May 1, 2024, 5:17 a.m.