R Graphics
by Paul Murrell

The SECOND EDITION of this book is now available, with its own web page.

A book on the core graphics facilities of the R language and environment for statistical computing and graphics (Chapman & Hall/CRC, August 2005).

A link to the publisher's web page for the book.

A list of Errata.

PDF version of the preface, table of contents, and Chapters 1, 4, and 5.

R code for figures:

An R add-on package called "RGraphics" is available from CRAN. This package contains: data sets used in the book (and not available in other existing packages); functions to reproduce the figures in the book, e.g., figure1.1(); and function, method, and class definitions from Chapter 7.

The R code presented in these pages is the R code actually used to produce the Figures in the book. There will be differences compared to the code chunks shown in the text of the book, but in most cases the differences will be that these pages contain additional code to lay out multiple plots on a single "page".

Some figures have been fine-tuned to a particular aspect ratio or even physical size, so the code will not reproduce exactly the same figure on a different-sized device.

These figures are raster equivalents or, in a couple of cases, raster conversions of the vector originals. The vector originals are of a much higher quality; these bitmaps are just to make it easier to identify a particular figure.

The code presented for each figure is self-contained, i.e., all code required to produce the figure is included. This means that there is sometimes considerable overlap of code between several figures (where the figures rely on common set-up code, e.g., the definition of variables, functions, or classes). This is particularly evident in the figures for Chapter 7. In some cases, it may be necessary to install an add-on package from CRAN to get the code to run.

Some of the figures from Chapters 2 and 3 (on traditional graphics) were actually produced using grid graphics code; it's just easier to do diagrams with grid sometimes.

Most of the code samples are valid for R versions 2.0.0 or 2.0.1, but there are some exceptions which are only valid for R version 2.1.0. The differences are mostly quite subtle and are described in detail in the book; at the last check, the following code samples did not produce the correct output using R 2.0.1:

For some versions of lattice (including 0.14-3, but fixed by 0.16-3) the plot margins were not a fixed size so Figure 4.8 does not reproduce correctly.

From R version 2.7.0, the font family "symbol" is no longer recognised. This affects Table 3.6 and Figure 3.9. The online version of Figure 3.9, and the associated code, has been updated to reflect this change.