ggstance for Two Treatment Effects

I was making a plot comparing how five outcomes varied by whether they occurred during Period 1 or Period 2.  I wanted to plot the standard error of each point, which would often cause points to become hidden by the error bars.  The obvious answer is to shift the 10 points (5 outcomes, 2 treatments) vertically so their error bars do not overlap.  (The five outcomes are on the y-axis, the x-axis is effect size with error bars.)

I could see the solution in base R but figured it would be dirty, so I decided to try ggplot.  It turns out that this has been a known quirk of ggplot for years, unless I wanted to put the five outcomes on the x-axis.  Doing that was not possible for other features of the graph not worth going into, so I thought I had hit a dead end, after a couple of long errors, and proceeded to get frustrated.

Fortunately, I was not the only one with this problem, and a particularly entrepreneurial person recently created ggstance specifically for this purpose.  Day saved!  It took another 20-30 minutes of figuring out that package, but overall I am very happy with the result.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: