Learn R Programming

grDevices (version 3.3.3)

gray: Gray Level Specification

Description

Create a vector of colors from a vector of gray levels.

Usage

gray(level, alpha = NULL)
grey(level, alpha = NULL)

Arguments

level
a vector of desired gray levels between 0 and 1; zero indicates "black" and one indicates "white".
alpha
the opacity, if specified.

Value

A vector of colors of the same length as level.

Details

The values returned by gray can be used with a col= specification in graphics functions or in par. grey is an alias for gray.

See Also

rainbow, hsv, hcl, rgb.

Examples

Run this code
gray(0:8 / 8)

Run the code above in your browser using DataLab