Grid


Grid is an add-on package for the R language and environment for statistical computing and graphics. It provides a set of graphical functions which support a great deal of flexibility in the layout of graphics.

A couple of other R packages/projects make use of grid: Deepayan Sarkar's lattice (distributed with R as a "Recommended" package), Frank Harrell's Hmisc and Design, and M Kondrin's RGrace. I have also built a couple of packages on top of grid myself; see gridBase (available from CRAN) and gridSVG (available from my home page).

Grid is now part of the base R distribution (i.e., it is distributed and installed as part of the standard R distribution).

On this page you will find package downloads for older versions of grid, information on the compatibility of different versions of grid and R, and lots of documentation for grid.

I also have a todo list which describes some of my future plans for the development of grid.


Package Downloads

The latest version is distributed with R.

You could try looking for a binary version for Windows here.


Version Information

grid is being developed alongside the development of the core R graphics API. This means that different versions of grid will only run on certain versions of R. The following table gives a partial list of grid-R version compatibilities (click on the links to get a tar ball for the corresponding version). Because many people use grid only as support for the lattice package, known grid-lattice compatibilities are also shown.

grid version lattice version R version
0.5 or 0.5-1 0.4-0 1.4.*
0.6 or 0.6-1 0.5-3 1.5.*
0.7-1 0.5-6 1.6.*
0.7-4 0.6-7 1.6.* or 1.7.*

From R 1.8.0 on, new grid versions are released with new versions of R, which alleviates the problem of which grid version to use.


Documentation

Part II of my forthcoming book R Graphics will contain the most comprehensive description of grid (in a single document) to date.

Documentation for grid is now distributed with the package as a series of vignettes -- type vignette() to see the list of available topics and vignette("<topic>") to view a PDF file describing the topic.

The vignettes are also available below, plus there are some extra bits and pieces that are not distributed with R. There are also links to more general overview articles, and a very short FAQ.

If you are interested in the future development of grid, there is also a list of plans and "todo"s.

Downloadable Documents

These documents correspond to the latest released verion of R, but there are links to older versions of the documentation (corresponding to previous versions of R going back to 1.8.*).

Links to Other Documents

The paper from a talk on grid given in the Proceedings of the 2nd International Workshop on Distributed Statistical Computing can be found here. NOTE: grid was originally called "lattice", but that name was too good not to use for R's implementation of Trellis so we changed; anyway, at the time of the conference it was still lattice so you are looking for the talk titled "R Lattice Graphics".

There is also an article on grid in Volume 2/2, June 2002 of the R News newsletter. In that article, the last example cannot be run because I rather stupidly used a private data set. Here is an R script that includes the data and the grid code for that example; you should be able to simply cut-and-paste or save-and-source() this to reproduce the figure. Thanks to Wendy Wrapson and Dr Niki Harre from the Department of Psychology at the University of Auckland for allowing me to make the data set available.

Another R News article (Volume 3/2, October 2003) discusses the integration of grid graphics with the default base graphics system using the gridBase package.

Yet another R News article (Volume 5/1, May 2005) provides an update on changes in grid mainly introduced in R Version 2.0.0.

There are also slides from some talks on grid. One given at UBC (Vancouver) and York University (Toronto) 2003, one given at a workshop at the ISM (Tokyo) 2003) on future graphics development, which includes some information on the future of grid graphics, and one at the first useR! conference in Vienna.

Finally, there is my book, R Graphics, Part II of which is on grid.

FAQ

  1. Does mathematical annotation work in grid (and lattice)?
    Yes, from grid version 0.7 on.
  2. Can I use "base" graphics functions with grid (and lattice)?
    The answer is a qualified "yes". From R 1.8.0 on, there is a package called gridBase on CRAN. This provides some functionality for combining grid and base output. The package includes a vignette explaining its use.