colr: Create a Range of Colors

View source: R/colr.R

colrR Documentation

Create a Range of Colors

Description

Create a range of colors between two specified colors.

Usage

colr(x, fromcolname, tocolname)

Arguments

x

A numeric vector, the values to be assigned colors.

fromcolname

A character or numeric scalar, indicating the color to use for the lowest value in x. Either a color name (as listed by colors(), a hexadecimal string of the form "#rrggbb" or "#rrggbbaa" (see rgb), or a positive integer i meaning palette()[i].

tocolname

A character or numeric scalar, indicating the color to use for the highest value in x. See fromcolname.

See Also

colors, palette.

Examples

x <- 1:10
plot(x, x, pch=16, col=colr(x, "blue", "yellow"), cex=4)

JVAdams/GLFC documentation built on Jan. 5, 2023, 12:59 a.m.