Deprecated Names: set
, theme
The color and style attributes of each plot can be individually set from the following list of attributes. For convenience, groups of these attributes are specified to define color themes, plus style sub-themes that apply to any theme, with default values: theme="lighbronze"
and sub.theme="default"
.
style(
theme=c("lightbronze", "darkred", "dodgerblue", "gray", "gold",
"darkgreen", "blue", "red", "rose", "green", "purple", "sienna",
"brown", "orange", "white"),
sub.theme=c("default", "black", "no.y.axis"), device.fill=getOption("device.fill"),
bg.fill=getOption("bg.fill"), bg.stroke=getOption("bg.stroke"),
bg.lwd=getOption("bg.lwd"), bg.lty=getOption("bg.lty"),
fill=NULL, bar.fill=getOption("bar.fill"), pt.fill=getOption("pt.fill"),
trans=NULL, trans.bar.fill=getOption("trans.bar.fill"),
trans.pt.fill=getOption("trans.pt.fill"),
stroke=NULL, bar.stroke=getOption("bar.stroke"),
pt.stroke=getOption("pt.stroke"),
se.fill=getOption("se.fill"), ellipse.fill=getOption("ellipse.fill"),
bubble.fill=getOption("bubble.fill"),
bubble.text.stroke=getOption("bubble.text.stroke"),
heat=getOption("heat"),
cex.axis=getOption("cex.axis"),
axis.x.stroke=getOption("axis.x.stroke"),
axis.y.stroke=getOption("axis.y.stroke"),
values.stroke=getOption("values.stroke"),
rotate.x=getOption("rotate.x"),
rotate.y=getOption("rotate.y"),
offset=getOption("offset"),
grid.stroke=NULL,
grid.x.stroke=getOption("grid.x.stroke"),
grid.y.stroke=getOption("grid.y.stroke"),
grid.lwd=getOption("grid.lwd"), grid.lty=getOption("grid.lty"),
lab.stroke=getOption("lab.stroke"),
lab.size=getOption("lab.size"),
main.stroke=getOption("main.stroke"),
segment.stroke=getOption("segment.stroke"),
add.stroke=getOption("add.stroke"),
add.cex=getOption("add.cex"),
add.lwd=getOption("add.lwd"),
add.lty=getOption("add.lty"),
add.fill=getOption("pt.fill"),
n.cat=getOption("n.cat"), suggest=getOption("suggest"),
quiet=getOption("quiet"), brief=getOption("brief"),
results=getOption("results"), explain=getOption("explain"),
interpret=getOption("interpret"), document=getOption("document"),
code=getOption("code"),
width=120, show=FALSE, …)
set(…)
The specified color scheme. If specified, re-sets all style attributes to their start-up values.
Further modification of the main themes.
Fill color of the entire device window.
Color of the plot background.
Color of border around the plot background, the box, that encloses
the plot, with a default of "black"
.
Line width of the box around the plot.
Line type of the box around the plot: "solid", "dashed", "dotted", "dotdash", "longdash", or "twodash", or "blank".
Color of a filled region, both bars and points.
Color of a filled region, such as a histogram bar.
Color of a filled region, such as a plotted point.
Transparency of a filled bar or rectangular region and points.
The transparency of a filled bar or rectangular region, such as a histogram bar or the box in a box plot. Value from 0 to 1, opaque to transparent.
The transparency of the inner region of a plotted point. Value from 0 to 1, opaque to transparent.
Color of a stroke, a line such as the border of bar or point.
Color of the border of a filled region such as a histogram bar.
Color of a line or outline of a filled region, such as the border of a plotted point.
Color of the fill for the standard error plot about a fit line in a scatter plot.
Color of the fill for an ellipse in a scatter plot.
Fill color of bubbles.
Color of bubble text.
Color of the heat map for correlation matrices.
Scale magnification factor, which by defaults displays the axis
values to be smaller than the axis labels. Provides the functionality of,
and can be replaced by, the standard R cex.axis.
Color of the x
-axis.
Color of the y
-axis.
Color of the font used to label the axis values.
Degrees that the x
-axis values are rotated, usually to
accommodate longer values, typically used in conjunction with offset
.
Degrees that the y
-axis values are rotated.
The spacing between the axis values and the axis. Default is 0.5. Larger values such as 1.0 are used to create space for the label when longer axis value names are rotated.
Color of the grid lines.
Color of the grid lines for the x
-axis.
Color of the grid lines for the y
-axis.
Width of grid lines.
Line type for grid lines: "solid", "dashed", "dotted", "dotdash", "longdash", or "twodash", or "blank".
Color of the axis labels.
Size of labels for x and y axes.
Color of the title.
Color of line segments.
Color of added text.
Size of added text.
Line width of added lines.
Line type of added lines.
Fill color of added rectangles.
Number of categories that specifies the largest number of unique
equally-spaced values of variable of a numeric data type for which the
variable will be analyzed as categorical. Applies to
ScatterPlot
and
SummaryStats
, and also to the functions such as
Histogram
when processing multiple graphs.
If TRUE
, then provide suggestions for alternative analyses.
If TRUE
then some functions suppress console output.
If set to TRUE
, reduced text output.
For the R markdown file generated by the Rmd option, show the results.
For the R markdown file generated by the Rmd option, explain the results.
For the R markdown file generated by the Rmd option, interpret the results.
For the R markdown file generated by the Rmd option, documents the code that generated the results.
For the R markdown file generated by the Rmd option, shows the code that generated the results.
Maximum width of each line displayed at the console, just accesses the standard R options function for width.
Option for showing all settings.
Parameter values.
OVERVIEW
Sets the default color palette via the R options
statement, as well as the transparency of plotted bars and points and other non-color characteristics such as the color of the grid lines. For convenience, groups of attributes are organized into themes and sub-themes. When theme
is specified, all options are reset to their default values. All other modifications, with individual parameters or grouped parameters as a sub-theme, are cumulative. For example, one sub-theme can be followed by another, as well as the specifications of individual attributes.
The "gray"
color theme is based on the colors used in Hadley Wickham's ggplot2
package. The "lightbronze"
theme, especially with the no.y.axis
sub-theme, is based on Jeffrey Arnold's wsj
theme from his ggthemes package.
SUB-THEMES
"black"
: Black background of the entire device window witth translucent fill colors from the current theme.
"no.y.axis"
: Similar to the wsj
theme from the ggthemes
package, especially with the theme of "lightbronze"
. The y
-axis is removed with though the value labels retained, the vertical grid is removed, and the horizontal grid is dotted and thicker than the default.
Arnold, Jeffrey B., (2017), ggthemes: Extra Themes, Scales and Geoms for 'ggplot2'. R package version 3.4.0. https://CRAN.R-project.org/package=ggthemes
Wickham, Hadley, (2009), ggplot2: Elegant Graphics for Data Analysis, 2nd edition, Springer.
# NOT RUN {
# some data
mydata <- rd("Employee", format="lessR", quiet=TRUE)
# gold colors embedded in a black background
style("gold", sub.theme="black")
Plot(Years, Salary, size=0, ellipse=seq(.1,.9,.1))
# four ways to go gray scale
# 1. remove the light bronze background from default lightbronze theme,
# which otherwise displays only in gray scale
style(device.fill="white")
# 2. gray scale with a light gray background
style("gray")
# 3. gray scale with a dark, almost black, background
style("gray", sub.theme="black")
# 4. mostly black and white
style("white")
# define a custom style beyond just colors
style(bg.fill="off", bg.stroke="off",
device.fill=rgb(247,242,230, maxColorValue=255),
pt.fill="black", trans=0,
lab.stroke="black", values.stroke="black",
axis.y.stroke="off",
grid.x.stroke="off", grid.y.stroke="black", grid.lty="dotted", grid.lwd=1)
hs(Salary)
# all numeric variables with 8 or less unique values and equally spaced
# intervals are analyzed as categorical variables
style(n.cat=8)
# }
Run the code above in your browser using DataLab