Advanced graphics in R

February 3, 2010

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

A lot of attention recently has gone to the more modern (and, dare I say, sexier) graphics systems in R, ggplot2 and lattice. But there's a lot of power in the base graphics system built into core R, especially when you want control over every aspect of how the graph is laid out. Ryan Rosario has put together some slides detailing some more advanced tricks capable with the base graphics system. For example:

  • How to create custom axes (for example, an axis on the right, or an axis labelled by dollars or other custom quantity)
  • How to overlay multiple scatterplots (and set the scaling of the axes appropriately)
  • How to create a custom legend
  • How to add gridlines to your graph
  • How to specify colors
  • And even how to create a movie from your graph

All the details are in Ryan's slides, and yes, the R code to create the example charts is also available.

Byte Mining: Advanced Graphics in R

To leave a comment for the author, please follow the link and comment on his blog: Revolutions. offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: , ,

Comments are closed.