An Overview of the Lattice Package
Lattice graphics consist of one or more rectangular drawing areas called panels. The data assigned to each panel is referred to as a packet. Lattice functions work by calling one or more panel functions, which actually plot the packets within panels. To change the appearance of a plot, you can specify arguments to the plotting function or change the panel function.
How Lattice Works
Here is what typically happens in a lattice session:
The end user calls a high-level lattice plotting function.
The lattice function examines the calling arguments and default parameters, assembles a lattice object, and returns the object. (Note that the class of the object is actually “trellis.” This means that many of the methods that act on an object, like
printorplot, are namedplot.trellisorprint.trellis.)The user calls
print.latticeorplot.latticewith the lattice object as an argument. (This typically happens automatically on the R console.)The function
plot.latticesets up the matrix of panels, assigns packets to different panels (specified by the argumentpacket.panel) and then calls the panel function specified in the lattice object to draw the individual panels.
Lattice graphics are extremely modular; they share many
high-level functions (like plot.lattice) and low-level functions
(like panel.axis, which draws axes). This means that they share many common arguments. It also means that you can customize the appearance of lattice graphics by creating substitute ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access