More R Graphics


This page has the following sections:

Base graphics
grid
lattice
ggplot2
Resources


Producing a plot in R for your own consumption is generally very easy. If you want complete control over every aspect of the plot, you have that as well -- but you may have to pay for it in time and frustration.

A source of frustration is that there is more than one graphics system in R, and they don't necessarily play well with each other.


Base graphics


The base graphics system is the oldest and -- as the name implies -- most basic. Base graphics produce static pictures. The par function is used to set up the graphics parameters that control the layout and look of the graphics.


grid


The grid package provides a much more flexible system of graphics. In particular, there are graph objects (see More R key objects for the idea of "object").


lattice


The lattice package contains a set of graphics techniques that are very useful for data analysis.


ggplot2


The statement of purpose for ggplot2 is:

ggplot2 is a plotting system for R, based on the grammar of graphics, which tries to take the good parts of base and lattice graphics and none of the bad parts. It takes care of many fiddly details that make plotting a hassle (like drawing legends) as well as providing a powerful model of graphics that makes it easy to produce complex multi-layered graphics.


Resources


An Introduction to R

This includes a discussion of graphics in R.

R for Beginners

This contains another discussion of graphics in R.

R Graph Gallery

An amazing collection of graphs made in R and how to do them yourself.

Graphics task view

This discusses a lot of packages that involve graphics.

ggplot2 home page

Using Lattice Graphics in R

home page of Paul Murrell, who wrote grid



Back to top level of Some hints for the R beginner



First Version: 2010 March 07   Last Modified: 2010 May 09

Direct access to this page is via
http://www.burns-stat.com/pages/Tutor/more_R_graphics.html