R Graphics, Second Edition: 2nd Edition (Hardback) book cover

R Graphics, Second Edition

By Paul Murrell

© 2011 – CRC Press

546 pages | 233 B/W Illus.

Purchasing Options:$ = USD
Hardback: 9781439831762
pub: 2011-06-02
eBook (VitalSource) : 9781498759625
pub: 2015-09-15
from $92.95

FREE Standard Shipping!
e–Inspection Copy


Extensively updated to reflect the evolution of statistics and computing, the second edition of the bestselling R Graphics comes complete with new packages and new examples. Paul Murrell, widely known as the leading expert on R graphics, has developed an in-depth resource that helps both neophyte and seasoned users master the intricacies of R graphics.

New in the Second Edition

  • Updated information on the core graphics engine, the traditional graphics system, the grid graphics system, and the lattice package
  • A new chapter on the ggplot2 package
  • New chapters on applications and extensions of R Graphics, including geographic maps, dynamic and interactive graphics, and node-and-edge graphs

Organized into five parts, R Graphics covers both "traditional" and newer, R-specific graphics systems. The book reviews the graphics facilities of the R language and describes R’s powerful grid graphics system. It then covers the graphics engine, which represents a common set of fundamental graphics facilities, and provides a series of brief overviews of the major areas of application for R graphics and the major extensions of R graphics.


"The book under review is a greatly extended second edition of the well-received 2006 book. The size has almost doubled by adding 12 new chapters of which one is a former appendix, so that the second edition now contains 19 chapters divided into four parts. … this edition is invaluable and a necessity for everyone who regularly has to produce graphs by using R."

—Stefan K. Lhachimi, Journal of the Royal Statistical Society, Series A, February 2014

"This is a timely revision for a well-liked book. … this book is the place to go for advice on how to draw that graphic. … The strengths of the book remain the clear exposition of the traditional and grid graphics systems and the numerous examples (for which the code is, of course, available on the book’s website). The new coverage of many other graphics packages adds to the book’s attractiveness and in particular the chapter on ggplot2 is an excellent introduction to a complex package. … a very good book, which will be of use to anyone working seriously with graphics in R."

—Antony Unwin, International Statistical Review, 2012

"A lot has changed in the world of statistical graphics during this time, which is reflected in the substantial new material in the second edition. … the changes make this book the essential and comprehensive guide to graphics in R. … This is an excellent book. Everyone who uses R to draw graphics should have a copy!"

Journal of Statistical Software, Vol. 43, September 2011

Praise for the First Edition:

"R Graphics is a must for many useRs and programmmeRs … Paul Murrell, a member of the R Core Development Team, has not only been the main author of ‘grid’ but has also been responsible for several recent enhancements to the underlying R graphics engine. Together with its online companion website, this book will be an indispensable resource for almost everyone interested in how to produce R graphics efficiently and intelligently."

—Martin Maechler, Swiss Federal Institute of Technology, Zurich

"Starting with the basic plotting commands most users are familiar with from introductory texts, the book gives a comprehensive overview of the current state and design principles of visualizing data with R. Paul Murrell is one of the main authors of R’s graphical facilities, and inventor of completely new features like the grid system or expressions for annotation of plots with mathematical formulae. … beginners gradually are turned into programmers while learning the language, having ample material for both novices and experts. It will certainly claim its place on the bookshelf of reference guides next to my desktop."

—Friedrich Leisch, Technical University of Vienna, Austria

"R Graphics is exactly the sort of documentation that R needs. It is written clearly, with many examples, and will be useful for any level of R expertise from novice upwards. It contains more than a hundred figures containing model code and its output. There are extensive cross-references that make finding detailed information easy. My copy of the book is from the first printing, but it is exceptionally free of typographical and other errors. … Murrell is to be congratulated."

—Duncan Murdoch, University of Western Ontario, Canada

"Thanks to Paul Murrell’s new book, the secrets of both traditional graphics and the new, modern grid system get unveiled … a must-have for novices and professionals alike, the ultimate guide to the power (and beauty) of R graphics."

—David Meyer, Vienna University of Economics and Business Administration, R News, 6(2), 2006

"It achieves its goal of documenting the graphical facilities of R and should be extremely useful to anyone in need of detailed knowledge, in particular, of R’s grid graphics."

—Soren Feodor Nielsen, University of Copenhagen, Journal of Applied Statistics, November 2007, Vol. 34, No. 9

Table of Contents

An Introduction to R Graphics

R graphics examples

The organization of R graphics


Simple Usage of Traditional Graphics

The traditional graphics model

The plot() function

Plots of a single variable

Plots of two variables

Plots of many variables

Arguments to graphics functions

Specialized plots

Interactive graphics

Customizing Traditional Graphics

The traditional graphics model in more detail

Controlling the appearance of plots

Arranging multiple plots

Annotating plots

Creating new plots


Trellis Graphics: the lattice Package

The lattice graphics model

Why another graphics system?

lattice plot types

The formula argument and multipanel conditioning

The group argument and legends

The layout argument and arranging plots

The scales argument and labelling axes

The panel argument and annotating plots

The par.settings argument and graphical parameters

Extending lattice plots

The Grammar of Graphics: the ggplot2 Package

Quick plots

The ggplot2 graphics model

Why another graphics system?


Geoms and aesthetics


Statistical transformations

The group aesthetic

Position adjustments

Coordinate transformations




Extending ggplot2

The grid Graphics Model

A brief overview of grid graphics

A simple example

Graphical primitives

Coordinate systems

Controlling the appearance of output


Missing values and non-finite values

Interactive graphics

Customizing lattice plots

Customizing ggplot2 output

The grid Graphics Object Model

Working with graphical output

Grob lists, trees, and paths

Working with graphical objects off-screen

7.Capturing output

Placing and packing grobs in frames

Other details about grobs

Saving and loading grid graphics

Working with lattice grobs

Working with ggplot2 grobs

Developing New Graphics Functions and Objects

An example


Simple graphics functions

Graphical objects

Debugging grid


Graphics Formats

Graphics devices

Graphical output formats

Including R graphics in other documents

Device-specific features

Multiple pages of output

Display lists

Extension packages

Graphical Parameters


Line styles

Data symbols


Mathematical formulae


Graphics Extensions

Tricks with text

Drawing formatted text on a plot

Avoiding text overlaps

Peculiar primitives

Confidence bars

Calculations on colors

Custom coordinates

Atypical axes

Plot Extensions

Venn diagrams

Chernoff faces

Ternary plots

Soil texture diagrams

Polar plots

Hexagonal binning

Graphics for Categorical Data

The vcd package


Plots of Categorical Data

Categorical data on the y-axis

Visualizing contingency tables

Categorical plot matrices

Multipanel categorical plots

Customizing categorical plots

The vcdExtra package


Map data

Map annotation

Complex polygons

Map projections

Raster maps

Other packages

Node-and-edge Graphs

Creating graphs

Graph layout and rendering

Other packages


3-D Graphics

3-D graphics concepts

The Canterbury earthquake

Traditional graphics

Lattice graphics

The scatterplot3d package

The rgl package

The vrmlgen package

Dynamic and Interactive Graphics

Dynamic Graphics

Interactive Graphics

Graphics GUIs

Interactive graphics for the web

Importing Graphics

The moon and the tides

Importing raster graphics

Importing vector graphics

Combining Graphics Systems

The gridBase package

About the Author

Paul Murrell attended Auckland University for his BSc (in Computer Science), BA (in Psychology), MSc (in Psychology), and PhD (in Statistics!). He then spent a year at the University of Cambridge in the Department of Community Medicine as a medical statistician and research assistant, before joining the Department of Statistics at Auckland University in October, 1999. His research interests include computational and graphical statistics. He is currently part of the development team for the R and Omegahat statistical computing projects. He was elected a Fellow of the American Statistical Association in 2010.

About the Series

Chapman & Hall/CRC The R Series

Learn more…

Subject Categories

BISAC Subject Codes/Headings:
COMPUTERS / Computer Graphics
MATHEMATICS / Probability & Statistics / General