Consider the following:

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"))

The output of that looks something like this: ggplot2 output In the context of plot.margin=unit(x=c(0,0,0,0),units="mm") there's an unseemly amount of white (red) space above the legend. Does anyone know how to remedy that?

Thanks for any hint.

Sincerely, Joh

Edit
Report