title: grid.layout in ggplot
body: <p>I'm using the following code to create three sets of plots in the amazing package ggplot2:</p>
  
  <pre><code>w&lt;-rnorm(100)
  x&lt;-rnorm(100)
  y&lt;-rnorm(100)
  z&lt;-rnorm(100)
  g&lt;-rep(factor(LETTERS[1:4]), 25)
  d&lt;-data.frame(g,w,x,y,z)
  
  library(ggplot2)
  
  pw&lt;-ggplot(d, aes(w, y))
  px&lt;-ggplot(d, aes(x, y))
  pz&lt;-ggplot(d, aes(z, y))
  
  pw+geom_point()+facet_grid(.~g, scales='fixed')+coord_equal()+stat_smooth(method='lm')
  px+geom_point()+facet_grid(.~g, scales='fixed')+coord_equal()+stat_smooth(method='lm')
  pz+geom_point()+facet_grid(.~g, scales='fixed')+coord_equal()+stat_smooth(method='lm')
  </code></pre>
  
  <p>I would make a PDF file that has each of these three sets of plots printed on the same page. My understanding is that<code>split.screen(c(3,1))</code>and<code>par(mfrow=c(3,1))</code>won't work with ggplot2 graphics, but that<code>grid.layout()</code>from the grid package would work so I tried:</p>
  
  <pre><code>pdf(file="test.pdf")
  pushViewport(viewport(layout=grid.layout(3,1)))
  print(pw+geom_point()+facet_grid(.~g, scales='fixed')+coord_equal()+stat_smooth(method='lm'))
  print(px+geom_point()+facet_grid(.~g, scales='fixed')+coord_equal()+stat_smooth(method='lm'))
  print(pz+geom_point()+facet_grid(.~g, scales='fixed')+coord_equal()+stat_smooth(method='lm'))
  dev.off()
  </code></pre>
  
  <p>but this ends up being a four page PDF file with the first page being blank and each set of figures following one per page and the x-axis label way down at the bottom. Is there a way to make a PDF file with all the sets of figures on the same page (and without a blank page leading!)? </p>