colChoose: Internal Function for Selecting Color Schemes Used by...

View source: R/colchoose.R

colChooseR Documentation

Internal Function for Selecting Color Schemes Used by longCatPlot

Description

Internal function used by longCatPlot to select color schemes based on the specified parameters.

Usage

colChoose(colScheme, nfactors, reverse = FALSE)

Arguments

colScheme

A character string specifying the color scheme to use. Options include:

  • "gray": A grayscale spectrum.

  • "rainbow": See rainbow.

  • "heat": See heat.colors.

  • "terrain": See terrain.colors.

  • "topo": See topo.colors.

  • "cm": See cm.colors.

Although no default is specified, "heat" is the default used when passed to colChoose by longCatPlot.

nfactors

The number of unique factors (levels) in the data. This parameter helps determine the number of colors needed.

reverse

Logical indicating whether the color scheme should be applied in reverse order. Default is FALSE.

Value

Returns a vector of colors based on the specified color scheme, number of factors, and whether the order is reversed.

Author(s)

Stephen J. Tueller

References

Tueller, S. J., Van Dorn, R. A., & Bobashev, G. V. (2016). Visualization of categorical longitudinal and times series data (Report No. MR-0033-1602). Research Triangle Park, NC: RTI Press. http://www.rti.org/publication/visualization-categorical-longitudinal-and-times-series-data

See Also

longCatPlot for how this function is used within plotting.

Examples

# Example usage within longCatPlot
times <- c(1,100,200,300,400,500,600)
f3lc <- longCat(example3, times, Labels=rep('',5))
longCatPlot(f3lc, main='colScheme=gray', colScheme='gray', lwd=.1, ylab='',
legendBuffer = .25)

# More examples showing different color schemes
par(mfrow=c(2,3), bg='wheat')
longCatPlot(f3lc, main='colScheme=rainbow', colScheme='rainbow', lwd=.1,
ylab='', legendBuffer = .25)
longCatPlot(f3lc, main='colScheme=heat', colScheme='heat', lwd=.1, ylab='',
legendBuffer = .25)
par(mfrow=c(1,1), bg='transparent')


stueller/longCatEDA documentation built on March 9, 2024, 4:08 a.m.