Late to the ggplot2 party

[This article was first published on Datavore Consulting » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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 about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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)