tags:

views:

225

answers:

1

I have a ggplot2 plot that looks like this:

alt text

from the following R code:

ggplot(newdata, aes(benefit, cost, colour = factor(opt), shape = factor(roster)))

+ facet_grid(. ~ location)

It's exactly what I need, except that the graph is too wide to be clearly read.

I'd like to be able to take the four rightmost locations and place them under the four leftmost, such that the scatter plots are ordered like this.

Adelaide   Brisbane   Cairns      Canberra

Darwin     Hobart     Melbourne   Sydney

Can I do this with facet_grid()? Or should I just create two plots and line them up in GIMP?

The documentation on facet_grid() doesn't seem to indicate that it's possible.

Thanks for the help :-)

+7  A: 

You could try

facet_wrap( ~ location, ncol = 4)
gd047
doh! that should have been easy. The only problem is that when I try to use facet_wrap as you said, the output window shows blank. Any ideas?
okay so facet_wrap(. ~ location, ncol = 4) doesn't work... needed facet_wrap(~ location, ncol = 4) (i see you edited to correct). Thanks kindly!