Customizing Lattice Graphics

Most lattice functions share common arguments; the same argument has a similar effect in multiple functions. This section describes what each of those arguments does. Additionally, this section explains how to fine-tune the output of lattice functions.

Common Arguments to Lattice Functions

Lattice functions share many common arguments. Instead of explaining what each function does separately I’ll explain them in a single table. (Note that the default values for many of these arguments, in particular the panel functions, aren’t the same among functions.)

ArgumentDescription
xThe object to plot. May be a formula, array, numeric vector, or table.
dataWhen x is a formula, data is a data frame in which the function is evaluated.
allow.multipleSpecifies how to interpret formulas of the form y1 + y2 ~ X | Z (where X is a function of multiple variables and Z may also be a function of multiple variables). By default, if allow.multiple=TRUE, then the lattice function will plot both y1 ~ X | Z and y2 ~ X | Z superimposed on the same panel. However, if you set allow.multiple=FALSE, then the lattice function will plot I(y1 + y2) ~ X | Z (summing y1 + y2).
outerSpecifies whether to superimpose plots or not when allow.multiple=TRUE and multiple dependent variables are specified. When outer=FALSE, the plots are superimposed; when outer=TRUE, plots are shown in different panels.
box.ratioFor plots that show data in rectangles (bwplot, barchart, and stripplot), a numeric value ...

Get R in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.