The R graphics landscape

In practical terms, there are three different ways of making graphics in R these days.

The CRAN Task View: Graphic Displays & Dynamic Graphics & Graphic Devices & Visualization provides a survey of the whole R graphics landscape.

Base or traditional R graphics

The most basic approach is to use the long-established, built-in facilities, referred to as base or traditional graphics. The advantages include

The disadvantages include

Because I feel so strongly that the add-on packages provide the best graphical "bang for your buck", especially for those new to R who don't need to relearn/unlearn anything, we will not provide explicit coverage of base graphics here. Some knowledge of base graphics will, however, eventually be useful for everyone. Therefore, here are a few resources to consult when more knowledge is needed.

lattice add-on package

The lattice package, authored by Deepayan Sarkar, was the first alternative to base graphics and it comes with any binary distribution of R, i.e. you should all already have it. A simple library(lattice) call will make it available in an R session and one can make that apply to all your R sessions via .Rprofile. The advantages include:

The disadvantages include:

Here are some good references for further reading:

ggplot2 add-on package

The ggplot2 package, authored by Hadley Wickham, appeared after lattice and is based on a Grammar of Graphics. Informally, it seems to be the graphics system of choice these days; for example, you will find more stackoverflow threads, blog posts, etc. that pertain to ggplot2 than to either base graphics or lattice. If you want to use it, you will need to install it:

install.packages("ggplot2", dependencies = TRUE)

A simple library(ggplot2) call will make it available in an R session and one can make that apply to all your R sessions via .Rprofile. The advantages include:

The disadvantages include:

Resources:

Cage match: which is better lattice or ggplot2?

As always in statistics, I guess, it depends. People more experienced with both than I am today have done some head-to-head comparisons, so read what they have to say: