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")

## List palettes
cpals()
dpals()

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

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.

pow

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. Conversely, for highly skewed data, using a power < 1 can reduce the impact of extreme values.

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 Oct. 19, 2024, 10:31 a.m.