Learn R Programming

lessR (version 2.3.1)

set: Set the Default Color Palette

Description

Each graph is based on a default color theme. The original default is "blue", but set allows other color palettes to be set as default as well.

Usage

set(colors=c("blue", "gray", "rose", "green", "gold", "red"),
         trans.pts=NULL)

Arguments

colors
The specified color scheme.
trans.pts
Specified level of transparency for plotted points, from 0 for no transparency to 1 for total transparency.

Details

Sets the default color palette via the R options statement, as well as the transparency of plotted points.

The gray color scheme is based on the colors used in Hadley Wickham's ggplot2 package.

References

Wickham, H., ggplot2: Elegant Graphics for Data Analysis, 2nd edition, 2009.

See Also

options.

Examples

Run this code
# set all subsequent graphic output to gray scale
set(colors="gray")

Run the code above in your browser using DataLab