title: ggplot theme remove y-axis on two plots in gtable, keep on third plot
body: <p>I am trying to remove the y-axis on two ggplots that are in a gtable with a third ggplot.  I would like to show the y-axis for the leftmost graph in the gtable and remove the y-axis completely from the subsequent graphs; however, I would like the x-axis to remain on all plots.</p>
  
  <p>My graph looks like this:
  ![nucleotide diversity][1]</p>
  
  <p>[1]: image produced by code</p>
  
  <pre><code>library("ggplot2")
  library("gridExtra")
  library("gtable")
  
  theme_set(theme_bw(base_size=16))
  
  
  p1 &lt;- ggplot(a.pi, aes(x=window, y=measure, fill=key, colour=key)) + 
    geom_line() + 
    scale_colour_manual(values=c("#000099", "#333333", "#FF0000")) + 
    ylab(expression(pi)) + 
    xlab("Position") +
    scale_x_continuous(breaks=c(1e+06, 2e+06, 3e+06, 4e+06), labels=c("1Mb", "2Mb", "3Mb", "4Mb"))+
    scale_y_continuous(limits=c(0.0,0.0004)) +
    theme(#axis.text.y = element_blank(),
          #axis.ticks.y = element_blank(),
          #axis.title.y = element_blank(),
          #axis.title.x = element_blank(),
          plot.margin = unit(c(0,-3,0,0), "lines"),
          plot.background = element_blank(),
          panel.background = element_blank(),
          panel.grid.major = element_blank(),
          panel.grid.minor = element_blank(),
          panel.border = element_blank(),
          legend.position="none",
          axis.line = element_line()
          ) 
  
  p2 &lt;- ggplot(b.pi, aes(x=window, y=measure, fill=key, colour=key)) + 
    geom_line() + 
    scale_colour_manual(values=c("#333333", "#FF0000")) + 
    #ylab(expression(pi)) + 
    xlab("Position") +
    scale_x_continuous(breaks=c(1e+06, 2e+06, 3e+06, 4e+06), labels=c("1Mb", "2Mb", "3Mb", "4Mb"))+
    scale_y_continuous(limits=c(0.0,0.0004)) +
    theme(axis.text.y = element_blank(),
          axis.ticks.y = element_blank(),
          axis.title.y = element_blank(),
          #axis.title.x = element_blank(),
          plot.margin = unit(c(0,-3,0,0), "lines"),
          plot.background = element_blank(),
          panel.background = element_blank(),
          panel.grid.major = element_blank(),
          panel.grid.minor = element_blank(),
          panel.border = element_blank(),
          legend.position="none",
          axis.line = element_line()
          ) 
  
  p3 &lt;- ggplot(c.pi, aes(x=window, y=measure, fill=key, colour=key)) + 
    geom_line() + 
    scale_colour_manual(values=c("#333333", "#FF0000")) + 
    #ylab(expression(pi)) + 
    xlab("Position") +
    scale_x_continuous(breaks=c(1e+06, 2e+06, 3e+06, 4e+06), labels=c("1Mb", "2Mb", "3Mb", "4Mb"))+
    scale_y_continuous(limits=c(0.0,0.0004)) +
    theme(axis.text.y = element_blank(),
          axis.ticks.y = element_blank(),
          axis.title.y = element_blank(),
          #axis.title.x = element_blank(),
          plot.margin = unit(c(0,-3,0,0), "lines"),
          plot.background = element_blank(),
          panel.background = element_blank(),
          panel.grid.major = element_blank(),
          panel.grid.minor = element_blank(),
          panel.border = element_blank(),
          legend.position="none",
          axis.line = element_line()
          ) 
  
  grid.arrange(p1,p2,p3, nrow=1)
  
  
  gt1 &lt;- ggplot_gtable(ggplot_build(p1))
  gt2 &lt;- ggplot_gtable(ggplot_build(p2))
  gt3 &lt;- ggplot_gtable(ggplot_build(p3))
  
  newWidth = unit.pmax(gt1$widths[1:3], gt2$widths[1:3], gt3$widths[1:3])
  
  gt1$widths[1:3] = as.list(newWidth)
  gt2$widths[1:3] = as.list(newWidth)
  gt3$widths[1:3] = as.list(newWidth)
  
  # New gtable with space for the three plots plus a right-hand margin
  gt = gtable(widths = unit(c(1, 1, 1, 0.3), "null"), height = unit(1, "null"))
  
  
  # Instert gt1, gt2 and gt2 into the new gtable
  gt &lt;- gtable_add_grob(gt, gt1, 1, 1)
  gt &lt;- gtable_add_grob(gt, gt2, 1, 2)
  gt &lt;- gtable_add_grob(gt, gt3, 1, 3)
  
  grid.newpage()
  grid.draw(gt)
  </code></pre>