number.to.colors: Convert from numbers to colors

Description Usage Arguments Value Author(s) See Also Examples

View source: R/string.to.color.R

Description

Automatically convert a vector of numbers into a color for easy plotting

Usage

1
number.to.colors(value, colors = c("red", "blue"), num = 100)

Arguments

value

a vector of numbers.

colors

a vector of two or more colors representing the inflection points of the gradients, passed to colorRampPalette.

num

The number of unique intervals for colors. Chose larger numbers for finer gradients (higher resolution).

Value

a vector of colors.

Author(s)

Dustin Fife

See Also

string.to.colors colorRampPalette gradient.legend

Examples

1
2
3
#### plot three variables, represent the third with a color
d = mvrnorm(100, mu=c(0,0,0), Sigma=matrix(c(1, .6, .6, .6, 1, .6, .6, .6, 1), ncol=3))
plot(d[,1:2], col=number.to.colors(d[,3], c("black", "pink")), pch=16)

dustinfife/fifer documentation built on Oct. 31, 2020, 3:36 p.m.