Learn R Programming

painter (version 0.1.0)

ColorBy: Assign colors using one or two numeric vectors

Description

These functions are intended to be used to color plotting symbols according to some numeric values or pair of numeric values associated with each point

Usage

ColorBy(x, palette)
ColorBy2(x,y,palette1, palette2, mode = "RGB")

Arguments

x

A vector of numeric values to color the points by

y

A vector of numeric values to color the points by, must be of the same length as x

palette

A vector of colors

palette1

A vector of colors

palette2

A vector of colors

mode

Specifies whether color mixtures should be in "RGB" or "HSV" mode

Value

A vector of colors of the same length as x

Examples

Run this code
# NOT RUN {
x = runif(100)
y = runif(100)

colors = ColorBy(x,rainbow(100))
plot(x,y,col=colors,pch=16,cex=2)

colors = ColorBy2(x,y,SetSaturation("Red",seq(0,1,0.1)),SetSaturation("Blue",seq(0,1,0.1)))
plot(x,y,col=colors,pch=16,cex=2)
# }

Run the code above in your browser using DataLab