Late to the ggplot2 party

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.

The following two tabs change content below.

Latest posts by Travis Hinkelman (see all)

One thought on “Late to the ggplot2 party

  1. Pingback: RStudio is RStupendous | Datavore Consulting | Blog

Leave a Reply