title: How to address the issue in plot size and legend in ggplot?
body: <p>I need help in ggplot and a sharing legend. Below is the Minimum working example which is similar to the problem I am struggling with. I need to adjust the sizes of these plots similar excluding the "ytick labels" on first plot. Also, the legend should come under the center of all three plots. I would appreciate any help in this.![enter image description here][1]...</p>
  
  <p>The code I am using is given below..</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>require(ggplot2)
  require(grid)
  require(gtable)
  require(gridExtra)
  
  Sp &lt;- c("A","B","C","E","G","F","D","H","I")
  Cl &lt;- c("One","Two","Three","One","Two","Three","One","Two","Three")
  S1 &lt;- c(0,1,1,0,3,1,3,2,3)
  S2 &lt;- c(2,0,3,2,0,2,2,0,1)
  S3 &lt;- c(0,3,0,1,1,0,1,3,1)
  
  data &lt;- as.data.frame(cbind(Sp,Cl,S1,S2,S3))
  
  data$Sp &lt;- as.character(data$Sp)
  data$Sp &lt;- factor(data$Sp, levels=unique(data$Sp))
  
  p1 &lt;- ggplot(data=data, aes(x=Sp, y=S1, fill=Cl)) +
  geom_bar(stat="identity") +
  coord_flip() +
  theme_bw() +
  theme(axis.title.y = element_blank()) +
  theme(legend.position="bottom") + 
  theme(plot.margin = unit(c(0.5, 0.25, 0.5, 0.25), "cm"))
  
  p2 &lt;- ggplot(data=data, aes(x=Sp, y=S2, fill=Cl)) +
  geom_bar(stat="identity") +
  coord_flip() +
  theme_bw() +
  theme(axis.title.y=element_blank(), axis.text.y=element_blank()) + 
  theme(plot.margin = unit(c(0.5, 0.25, 0.5, 0.25), "cm"))
   
  p3 &lt;- ggplot(data=data, aes(x=Sp, y=S3, fill=Cl)) +
  geom_bar(stat="identity") +
  coord_flip() +
  theme_bw() +
  theme(axis.title.y=element_blank(), axis.text.y=element_blank()) +
  theme(plot.margin = unit(c(0.5, 0.25, 0.5, 0.25), "cm"))
  
  ## Single legend
  g_legend &lt;- function(a.gplot){
  tmp &lt;- ggplot_gtable(ggplot_build(a.gplot))
  leg &lt;- which(sapply(tmp$grobs, function(x) x$name) == "guide-box")
  legend &lt;- tmp$grobs[[leg]]
  return(legend)}
  
  ######################################### 
  mylegend &lt;- g_legend(p1)
  #########################################
  
  p4 &lt;- grid.arrange(p1 + theme(legend.position="none"), arrangeGrob(p2 + theme(legend.position="none"), p3 + theme(legend.position="none"), nrow=1), widths=c(1, 1, 1), nrow=2, mylegend, heights=c(10,0.5))</code></pre>
  </div>
  </div>
  </p>