title: ggplot legend list is larger than page
body: <p>I have a plot in R which has a very large number of sample groups, and therefore the legend is larger than the page size and is cut off.  I understand that this is not publication quality, but I need to know the colours to be able to make the legend in Illustrator.</p>
  
  <p>Is there a way to make the page size much bigger or somehow change the legend format so that I can include all the keys?  The reason for this is so that I can open the PDF in Illustrator and get the colours for each sample to create a new legend that will be for publication.  I thought that maybe there is a clipping mask, and that the actual legend will be preserved, but when I opened in Illustrator, the legend was actually cut at the page ends1.</p>
  
  <p><img src="https://i.stack.imgur.com/0QLwH.png" alt="Here is one exmple where the legend goes beyond the graph and the page size and is therefore cut off."></p>
  
  <p>As was suggested in the comments below I gave nrow a try which helped break the legends up but now the entire page is just legends.</p>
  
  <pre><code>ggplot(purine.n, aes(x=variable, y=value, colour=metabolite_gene, shape=variable))
  +geom_abline(slope=0)
  +geom_point(size=4, position=position_dodge(width=0.08))
  +scale_y_continuous(limit=c(-3.5,5.5), breaks=c(-3,-2,-1,0,1,2,3,4,5))
  +scale_shape_manual(values=c(16,17,17), guide=F)
  +theme_bw()
  +theme(legend.key=element_blank(), legend.key.size=unit(1,"point"))
  +guides(colour=guide_legend(nrow=16))
  </code></pre>