# 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

This includes a discussion of graphics in R.

This contains another discussion of graphics in R.

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

This discusses a lot of packages that involve graphics.

## See also

- The R graphics blog tag

Back to top level of Impatient R