Generate Gamma-Corrected Shades of Gray

DESCRIPTION:

Generate a set of gamma-corrected gray shades at specified levels.

USAGE:

gray.colors(n, start=0.3, end=0.9, gamma=2.2)
grey.colors(n, start=0.3, end=0.9, gamma=2.2)

REQUIRED ARGUMENTS:

n
Number of values

OPTIONAL ARGUMENTS:

start
Starting gray level between 0 and 1.
end
Ending gray level between 0 and 1.
gamma
Gamma correction.

VALUE:

Character vector of RGB values for the specified number of gray values. These are generated by adjusting the start and end values for gamma, generating a sequence, adjusting the sequence for gamma, and using gray to generate the sequence of colors. The transformations and sequence generation are:
        x <- seq(start^gamma, end^gamma, length = n)^(1/gamma)
        gray(x^(1/gamma))

SIDE EFFECTS:

None

DETAILS:

Gamma correction is an adjustment applied to colors to compensate for the nonlinearities in imaging systems such as computer displays.

SEE ALSO:

.

EXAMPLES:

# Generate a sequence of 100 shades of gray
gray.colors(100)