createColorPalette: Create a color palette

View source: R/createColorPalette.R

createColorPaletteR Documentation

Create a color palette

Description

Creates a color palette (or returns a pre-defined one).

Usage

createColorPalette(
  name,
  n = 1,
  alpha = 1,
  start = 0,
  end = max(1, n - 1)/n,
  s = 1,
  v = 1,
  bias = 1,
  space = c("rgb", "Lab"),
  interpolate = c("linear", "spline"),
  clrs = c("#00007F", "blue", "#007FFF", "cyan", "#7FFF7F", "yellow", "#FF7F00", "red",
    "#7F0000"),
  showAsWheel = FALSE,
  showAsBar = FALSE
)

Arguments

name
  • name of base palette to use (pre-defined: 'rainbow','heat','topo', 'cm', and 'jet'; 'ramp' for new palette)

n
  • number of colors to include in palette

alpha
  • transparency (0-1)

start
  • value associated with 1st color in palette

end
  • value associated with last color in palette

s
  • parameter passed to "rainbow" function

v
  • parameter passed to "rainbow" function

bias
  • ??

space
  • colorspace ('rgb' or 'Lab')

interpolate
  • interpolation scheme ('linear' or 'spline')

clrs
  • vector of colors defining base palette

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 (interpolated) palettes can be created based on the following pre-defined palettes:
'rainbow', 'heat', 'topo', 'cm', and 'jet'
Specifying a pre-defined palette eliminates the need to specify the 'clrs' color vector.
Palettes can created based on arbitrary base palettes by specifying name as 'ramp' and providing a vector of colors to use as the base palette (via clrs). This approach uses the graphics function "colorRampPalette" to create the palette.

Value

a color palette


wStockhausen/wtsUtilities documentation built on March 16, 2024, 10:38 a.m.