Tutorial: Introduction to Grid Graphics
Murrell, Department of Statistics, The University
of Auckland, New Zealand.
R is not only a powerful statistical graphics platform
for generating statistical plots. R is also a general
purpose graphics system. It is not only possible to produce
a wide variety of plots. It is possible to produce an
infinite variety of graphical images with R. This
tutorial will present an introduction to the grid
graphics package, a low-level graphics system that provides
full access to the graphics facilities in R. Knowledge of this
system will allow you to make arbitrary modications to plots
produced by packages such as lattice and
ggplot2 and it will allow you to produce a range of
diagrams and data visualizations that is limited only by your
Entré (approx. 15 min): A peek under the hood of
lattice and ggplot2 to see if grid
is hiding underneath.
Main (approx. 2 hrs, with 15 min break in middle): The
fundamentals of grid
A view of the grobs and viewports left behind after
lattice and ggplot2 have done their
Simple demonstration of adding new drawing or editing
existing drawing in lattice and ggplot2
This section will be illustrated and motivated by the task of
producing a custom data visualization. There will also be small
exercises for attendees to work on.
Graphical primitives (lines, rectangles, polygons, circles,
text, roundrects, X-splines, paths, rasters).
Graphical parameters (colours, fonts, line types).
Units and coordinate systems.
Viewports (pushing, navigating, clipping) and layouts.
Grobs (creating, querying, and editing).
Dessert (approx. 15 min): Example applications of
Editing a lattice plot to modify line endings
Adding a custom axis to a lattice plot
Customising a ggplot2 legend
This course will not be appropriate for complete R newbies. It
will be assumed that the audience is familiar with R and
comfortable writing R expressions. On the other hand, no
statistical or graphical expertise will be required.
Attendees are expected to bring laptops with R installed so
that they can attempt exercises or examples during the
Watch this space! Please check back closer to the time for data
sets and code related to the course.
Please check here for up to date tutorial resources.