C_02a_standard.theme {lattice}R Documentation

Built-in Graphical Themes


Built-in graphical parameter settings. These mainly differ in their choice of colors.


standard.theme(name, color = TRUE,
               symbol = palette.colors(palette = "Okabe-Ito")[c(6, 2, 4, 7, 3, 5, 8)],
               fill   = NULL,
               region = hcl.colors(14, palette = "YlGnBu", rev = TRUE),
               reference = "gray90",
               bg = "transparent",
               fg = "black",
custom_theme(symbol, fill, region,
             reference = "gray90", bg = "transparent", fg = "black",
             strip.bg = rep("gray95", 7), strip.fg = rep("gray70", 7),
classic.theme(name, color)



character string giving the name of the device for which the setting is required, as returned by .Device. This is only used by classic.theme to allow device-specific setting. It is retained in standard.theme for back-compatibilty, but its use is not recommended.


logical, whether the initial settings should be color or black and white.


vector of colors to be used for symbols and lines.


vector of colors to be used as fill colors, e.g., in bar charts and histograms. The default of NULL in standard.theme results in lightened versions of the symbol colors to be used.


vector of colors to be used to create a color ramp, typically used by levelplot


color, to be used for reference lines.


color, to be used for foreground elements such as axes and labels.


color, to be used as background.


color, to be used as strip background.


color, to be used as strip foreground.


additional arguments, passed on to other functions as appropriate. In particular, additional arguments provided to standard.theme will be passed on to custom_theme, and these may include non-color parameters that will be used to modify the resulting theme via simpleTheme.


Trellis Graphics functions obtain the default values of various graphical parameters (colors, line types, fonts, etc.) from a customizable “settings” list (see trellis.par.set for details). This functionality is analogous to par for standard R graphics and, together with lattice.options, mostly supplants it (par settings are mostly ignored by Lattice). Unlike par, Trellis settings can be controlled separately for each different device type (but not concurrently for different instances of the same device).

The functions documented in this page produce such graphical settings (a.k.a. themes), usually to be used with trellis.device or trellis.par.set.

classic.theme and col.whitebg produce predefined themes that are not recommended for routine use but retained for compatibility.

The classic.theme function was intended to provide device specific settings (e.g. light colors on a grey background for screen devices, dark colors or black and white for print devices) and was used to obtain defaults prior to R 2.3.0. However, these settings are not always appropriate, due to the variety of platforms and hardware settings on which R is used, as well as the fact that a plot created on a particular device may be subsequently used in many different ways. For this reason, common device-agnostic defaults were used for all devices from R 2.3.0 onwards. The earlier behaviour can be reinstated by setting classic.theme as the default theme argument, e.g. by putting lattice.options(default.theme = "classic.theme") in a startup script (see the entry for theme in trellis.device for details).

Since R 2.4.3, a new set of defaults given by standard.theme is used. The defaults are based on HCL palettes, but customization of the palettes is allowed.

custom_theme is the workhorse function called by standard.theme. canonical.theme is an alias for standard.theme.


A list of components defining graphical parameter settings for Lattice displays. It is used internally in trellis.device, and can also be used as the theme argument to trellis.par.set

col.whitebg returns a similar (but smaller) list that is suitable as the theme argument to trellis.device and trellis.par.set. It contains settings values which provide colors suitable for plotting on a white background. Note that the name col.whitebg is somewhat of a misnomer, since it actually sets the background to transparent rather than white.


Deepayan Sarkar Deepayan.Sarkar@R-project.org


Sarkar, Deepayan (2008) Lattice: Multivariate Data Visualization with R, Springer. http://lmdvr.r-forge.r-project.org/

See Also

Lattice for an overview of the lattice package.

Devices for valid choices of device on your platform.

trellis.par.get and trellis.par.set can be used to query and modify the settings after a device has been initialized. The par.settings argument to high level functions, described in xyplot, can be used to attach transient settings to a "trellis" object.

[Package lattice version 0.21-8 Index]