quantCol: Return colors based on a palette and quantitative variable

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/quantCol.R

Description

Assign colors to the values of a variable

Usage

1
2
quantCol(x, pal, trans = c("linear", "log", "quadratic", "cubic"),
  xlim = NULL)

Arguments

x

the quantitative variable to be assigned colors

pal

the colors to be supplied to colorRamp

trans

the transformation to use on x

xlim

limits on the variable x, can be omitted, in which case the range of x is used

Details

This function linearly scales a variable to [0, 1] (potentially after a non- linear transformation) and uses those scaled values as input into colorRamp

Value

A character vector of the desired colors

Author(s)

Andy Rominger <ajrominger@gmail.com>

See Also

colorRamp

Examples

1
2
x <- 1:10
plot(x, col = quantCol(x, c('blue', 'red')))

ajrominger/socorro documentation built on Jan. 3, 2020, 6:25 a.m.