Learn R Programming

tiger (version 0.2.3.1)

color.factor: Create colors with intensity according to the magnitude of a value

Description

Create colors with intensity according to the magnitude of a value

Usage

color.factor(color, value, max)

Arguments

color
The base color(s) to use
value
A vector of values
max
The maximum value represented by full intensity

Value

A vector of colors, one entry for each value

Examples

Run this code
   data <- 1:10
   cols=color.factor("red", data, max=10)
   plot(data, col=cols)


   cols=color.factor(c("red","green","blue"), data, max=10)
   plot(data, col=cols)

Run the code above in your browser using DataLab