Late to the ggplot2 party

August 29, 2012

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

I have resisted learning the popular R graphics package, ggplot2. I dismissed ggplot2 as primarily useful for exploratory graphics and rationalized my avoidance of ggplot2 by assuming that it would require just as many (or more) lines of code as the R base package to whip the default plots into publication-quality figures. The few times that I poked at ggplot2 I quickly retreated to the cozy confines of the base package (see here, here, and here for tips on creating figures with base graphics).

Well, the tipping point for me came from an unlikely source—a web interface for ggplot2. Watch the demo video below to get a taste of the power of ggplot2 through the web.

The web interface is primarily intended for use “as a tool for rapid prototyping, exploratory graphical analysis and education of statistics and R.” For example, you can’t change attributes associated with axis labels, legends, or even the default grey background. You won’t be producing publication-quality figures with this web tool, but it provides a very accessible way to learn the underlying philosophy of ggplot2.

The web tool also includes a code window that allows you to copy and paste the ggplot2 code (generated by the web tool) into an R script—a key component of reproducible research. By prototyping your figure with the web tool, you create a block of code that serves as a foundation that you can tweak to your own aesthetic preferences. For me, that extra push up the ggplot2 learning curve was exactly what I needed to give ggplot2 a chance to displace R base graphics as my primary plotting package. I was also impressed by the ggplot2 user community, which seems to be quite enthusiastic and helpful. Check out the Cookbook for R for lots of useful tips on how to modify elements of ggplot2 graphics.

To leave a comment for the author, please follow the link and comment on their blog: Datavore Consulting » R. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, 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...

Comments are closed.


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)