ggplot2 quickly makes beautiful plots in R

Earlier I wrote about the open-source free tools I use to plot and analyze my data—Python and R. One of the most time-consuming and fiddly parts of making graphs for our papers is the need to:

  • plot multiple subsets of the data (different experimental conditions), sometimes with double axes
  • make a whole array of plots, one for each of the experimental participants’ data

I’ve been doing this in python with scipy by coding an outer loop iterating over the different participants’ data and the inner loop iterating through the experimental conditions. I also write code to label all the conditions and participants, put the horizontal axes only on the bottom-most plots, the vertical axis only on the left-most plots, and sometimes code to offset the different conditions’ data points slightly so they don’t completely occlude each other. This can be a huge pain.

Recently Dani has discovered a much better way. There is a library of R code called ggplot2 that does all these things for you and more to yield really beautiful and clean arrays of plots. Dani has posted an example of the few lines of code needed and the resulting plot. Ideally I would like to do all this in Python without having to use R but the ggplot2 R library is wonderful and I haven’t seen anything remotely like it (yet) for Python.

One thought on “ggplot2 quickly makes beautiful plots in R

  1. Accessing ggplot2 easily from Python has been getting getting closer:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s