Monday, July 20, 2009

ggplot2: more wicked-cool plots in R

As far as I know there are 3 different systems for producing figures in R: (1) base graphics, included with R, (2) the lattice package, and (3) ggplot2, one of the newer plotting systems which is, according to the creator Hadley Wickham, "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 of the 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."

ggplot2 works much differently than the the base graphics package you might be used to, so here's where to go for some documentation:

A blog called Learning R has put together a 6-part (and counting) series of posts dedicated to taking the book on the lattice package and recreating all the examples using ggplot2. Look at these to get an idea of the stylish Tufte-friendly graphics ggplot2 can create.

Part 1
Part 2
Part 3
Part 4
Part 5
Part 6

Next, Springer is publishing a book on ggplot2 next week, but until it's published, you can download the entire PDF for free along with example code at the ggplot2 website. So hurry up and download it - publication is set for July 28!

No comments:

Post a Comment

Creative Commons License
Getting Genetics Done by Stephen Turner is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.