discrete.color: Map numbers onto a palette

Description Usage Arguments Value Author(s) See Also Examples

View source: R/colors.r

Description

The continuous interval defined by range is divided into bins of equal size. Each bin is mapped to a colour in the palette defined by pal. The values in x are then assigned to the bins and their corresponding colours are returned. Values outside the interval are assigned to the border bins.

Usage

1
discrete.color(x, range = range(x), pal = "GnRd")

Arguments

x

Continuous numbers.

range

The interval in x that will be mapped to the palette.

pal

Palette. Can be the name of a predefined palette, as returned by xterm.pal, or a vector of colour indices directly.

Value

Colour indices from pal corresponding to where in the range the values in x are.

Author(s)

Christofer B<c3><a4>cklin

See Also

xterm.pal

Examples

1
2
3
error.rates <- .6*runif(10)
for(q in error.rates)
  style(q, "\n", fg=discrete.color(q, c(0, .5), "GnRd"))

backlin/xtermStyle documentation built on June 4, 2017, 12:12 a.m.