Learn R Programming

lessR (version 2.5)

set: Set the Default Color Theme and Other System Settings

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. Other system settings are also available.

Usage

set(colors=c("blue", "gray", "rose", "green", "gold", "red"),
         trans.pts=NULL, n.cat=4, width=120)

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.
n.cat
Specifies the largest number of unique values of variable of a numeric data type for which the variable will be analyzed as categorical. Set to 0 to turn off.
width
Maximum width of each line displayed at the console, just accesses the standard R options function for width.

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