col.alpha: Color utility functions

Description Usage Arguments Details Author(s) See Also

Description

Functions for calculating transparent and desaturated colors.

Usage

1
2
3
col.alpha( acol , alpha = 0.2 )
col.desat( acol , amt = 0.5 )
col.dist( x , mu = 0 , sd = 1 , col="slateblue" )

Arguments

acol

A color name or RGB color

alpha

alpha transparency, where 1 means fully opaque and 0 fully transparent

amt

amount of desaturation of color to apply, where 1 means totally desaturated (grayscale)

x

A vector of values to use for calculating distances. See details below.

mu

Value (or vector of values) to use for calculating distances

sd

Standard deviation of distance function used to calculate transparency

col

A color to apply transparency to, based on distance

Details

These functions allow for calculating transparency and desaturation for colors. col.alpha makes a base color transparent, while col.desat makes a color have less saturation.

col.dist is used to make a list of transparent colors of differing alpha level. The levels are chosen based upon Gaussian distance from a chosen value, mu, with a chosen width of the function that determines how quickly colors become fully transparent, sd. For example, if x contains a column of data, then col.dist will return a vector of same length with transparency increasing as each value in x is distant from mu. This is useful for plotting data that emphasize points near some value or values.

Author(s)

Richard McElreath

See Also

col2rgb, rgb2hsv, rgb


joepowers16/rethinking documentation built on June 2, 2019, 6:52 p.m.