Learn R Programming

prismatic (version 1.1.2)

color: Turn vector to color vector

Description

Turn vector to color vector

Usage

color(col)

colour(col)

Value

a colors object.

Arguments

col

a color object or vector of any of the three kinds of R color specifications, i.e., 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].

Details

Alpha values will be automatically added to hexcodes. If none at present it will default to no alpha (FF).

Examples

Run this code
terrain_10 <- color(terrain.colors(10))

terrain_10[1:4]

plot(terrain_10)

plot(terrain_10, labels = TRUE)

grey_10 <- color(gray.colors(10, start = 0, end = 1))

grey_10

plot(grey_10, labels = TRUE)

Run the code above in your browser using DataLab