Рассмотрим следующее:
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"))
Результат этого выглядит примерно так:
В контексте
plot.margin=unit(x=c(0,0,0,0),units="mm")
есть неподходящее количество белого (красного) пространства над легендой. Кто-нибудь знает, как исправить это?
Спасибо за любой намек.
С уважением, Joh