title: ggplot2, legend on top and margin
body: <p>Consider the following:</p>
  
  <pre><code>library(ggplot2)
  library(grid)
  ggplot(diamonds, aes(clarity, fill=cut)) + 
    geom_bar() +   
    theme(
      plot.margin=unit(x=c(0,0,0,0),units="mm"),
      legend.position="top",
      plot.background=element_rect(fill="red")) +
    guides(fill=guide_legend(title.position="top"))
  </code></pre>
  
  <p>The output of that looks something like this:
  <img src="https://i.stack.imgur.com/PeMAB.png" alt="ggplot2 output">
  In the context of <code>plot.margin=unit(x=c(0,0,0,0),units="mm")</code> there's an unseemly amount of white (red) space above the legend. Does anyone know how to remedy that?</p>
  
  <p>Thanks for any hint.</p>
  
  <p>Sincerely, Joh</p>