Lattice is best thought of as an implementation of Trellis Graphics
for R. It is built upon the Grid graphics engine and requires the
grid
add-on package. It is not (readily) compatible with
traditional R graphics tools. The public interface is based on the
implementation in S-PLUS, but features several extensions, in addition
to incompatibilities introduced through the use of grid
. To
the extent possible, care has been taken to ensure that existing
Trellis code written for S-PLUS works unchanged (or with minimal
change) in Lattice. If you are having problems porting S-PLUS code,
read the entry for panel
in the documentation for
xyplot
. Most high level Trellis functions in S-PLUS are
implemented, with the exception of piechart
.
Type help(package = lattice)
to see a list of (public)
Lattice graphics functions for which further documentation is
available. The
The example section below shows how to bring up a brief history of changes to the lattice package, which provides a summary of new features.
Bell Lab's Trellis Page:
Cleveland, W.S. (1993) Visualizing Data.
Becker, R.A., Cleveland, W.S. and Shyu, M.
xyplot
. This
includes a discussion of conditioning and control of the
Trellis layout. Lattice employs an extensive system of user-controllable parameters to
determine the look and feel of the displays it produces. To learn how
to use and customise the Graphical parameters used by the Lattice
functions, see trellis.par.set
. For other settings, see
lattice.options
. The default graphical settings are
different for different graphical devices. To learn how to initialise
new devices with the desired settings or change the settings of the
current device, see trellis.device
.
To learn about sophisticated (non-default) printing capabilities, see
print.trellis
. See update.trellis
to
learn about manipulating a "trellis"
object. Tools to augment
lattice plots after they are drawn (including
locator
-like functionality) is described in the
trellis.focus
help page.
The following is a list of panel
function, which has a suitable default, but can be substituted by an
user defined function to create custom displays. The user will most
often be interested in the default panel functions, which have a
separate help page, linked to from the help pages of the corresponding
high level function. Although documented separately, arguments to
these panel functions can be supplied directly to the high level
functions, which will forward the arguments as appropriate.
Univariate:
barchart
bar plots
bwplot
box and whisker plots
densityplot
kernel density plots
dotplot
dot plots
histogram
histograms
qqmath
quantile plots against mathematical distributions
stripplot
1-dimensional scatterplot
Bivariate:
qq
q-q plot for comparing two distributions
xyplot
scatter plot (and possibly a lot more)
Trivariate:
levelplot
level plots (similar to image plots in R)
contourplot
contour plots
cloud
3-D scatter plots
wireframe
3-D surfaces (similar to persp plots in R)
Hypervariate:
splom
scatterplot matrix
parallel
parallel coordinate plots
Miscellaneous:
rfs
residual and fitted value plot (also see
oneway
)
tmd
Tukey Mean-Difference plot
Additionally, there are several panel functions that do little by
themselves, but can be useful components of custom panel functions.
These are documented in panel.functions
. Lattice also
has a collection of convenience functions that correspond to the base
graphics primitives lines
, points
,
etc. They are implemented using Grid graphics, but try to be as close
to the base versions as possible in terms of their argument
list. These functions have imaginative names like
llines
or panel.lines
and are often useful
when writing (or porting from S-PLUS code) nontrivial panel functions.
RShowDoc("NEWS", package = "lattice")
Run the code above in your browser using DataLab