makeColorFun: Generate a color interpolation function.

Description Usage Arguments Details Value Examples

View source: R/graphutils.R

Description

Generates a function that calculates a color scale.

Usage

1
2
makeColorFun(xmin, xmax, n = 100, palette = cfd.colors, underflow = NULL,
  overflow = NULL)

Arguments

xmin

Minimum value of the color scale.

xmax

Maximim value of the color scale.

n

Number of intermediate colors.

palette

Color palette used.

underflow

Color to use for smaller values, first color if NULL.

underflow

Color to use for largerr values, first color if NULL.

Details

In filled contour plots, a color corresponds to a value. This function creates a new function that given a value, returns the corresponding color. This function can use several different color palettes and can handle values outside the values limits.

Value

Function that returns a color given a numeric value.

Examples

1
2
3
4
5
6
7
fun <- makeColorFun(0, 1, underflow='black', overflow='white')
x <- c(-1, seq(0, 1, len=5), 2)
xcol <- fun(x)
keyWindow(x, xcol)
fun <- makeColorFun(0, 1)
xcol <- fun(x)
keyWindow(x, xcol)

tunelipt/wutils documentation built on Nov. 5, 2019, 11:01 a.m.