color.scale {plotrix}R Documentation

color.scale

Description

color.scale calculates sequences of three colors by linearly interpolating between the values specified for each color. If only one number is supplied for a color, that color remains constant for all values of x. If more than two values are supplied, only the first two are used. If any values for a color range are less than 0 or greater than 255, that range is rescaled into 0->255.

Usage

 color.scale(x,redrange,greenrange,bluerange,scale.up=FALSE)

Arguments

x a numeric vector
redrange,greenrange,bluerange
scale.up Whether to scale color values less than or equal to 1 into a 0->255 range. If colors are specified in a 0->1 range, set this to TRUE.

Value

A vector of hexadecimal color values as used by col.

See Also

rgb.to.hex,rescale

Examples

 # go from green to red with a constant blue value
 x<-rnorm(20)
 y<-rnorm(20)
 # use y for the color scale
 plot(x,y,col=color.scale(y,c(0,1),c(1,0),0.3,scale.up=TRUE))

[Package plotrix version 1.2 Index]