createColorScale: Create a function defining a color scale.

Description Usage Arguments Details Value

View source: R/createColorScale.R

Description

Creates a function defining a color scale. The resulting function (e.g., 'scale') is used as
clr <- scale(x,mn=sclMin,mx=sclMax,alpha=alpha)
to return a color based on the color associated with value x (scaled into the interval sclMin to sclMax) in the defined color scale, with transparency 'alpha'.

Usage

1
2
3
4
createColorScale(clrs = c("#00007F", "blue", "#007FFF", "cyan", "#7FFF7F",
  "yellow", "#FF7F00", "red", "#7F0000"), name = NULL, bias = 1,
  space = c("rgb", "Lab"), interpolate = c("linear", "spline"),
  showAsWheel = FALSE, showAsBar = FALSE)

Arguments

name

- name of base color scale (pre-defined: 'jet', 'coldhot', 'cold', and 'hot'; NULL for new scale)

clrs

- vector of colors defining the base scale (ignored if 'name' is given)

bias

- ??

space

- colorspace ('rgb' or 'Lab')

interpolate

- interpolation scheme ('linear' or 'spline')

showAsWheel

- flag (T/F) to show the final palette as a colorwheel

showAsBar

- flag (T/F) to show final palette as a colorbar

Details

New color scales can be created based on pre-defined color vectors using the following names:
'jet', 'coldhot', 'cold', and 'hot'
Specifying a pre-defined name eliminates the need to specify the 'clrs' color vector.
Arbitrary scales can created by specifying NULL for 'name' (the default) and providing a vector of colors to use to define the scale function. This uses the graphics function "colorRamp" to define the underlying color ramp used for the scale.

Value

a function reflecting a color scale.


wStockhausen/wtsPlotUtils documentation built on May 3, 2019, 7:37 p.m.