考虑以下:
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"))
Run Code Online (Sandbox Code Playgroud)
输出看起来像这样:
在plot.margin=unit(x=c(0,0,0,0),units="mm")传说上方有一个不寻常的白色(红色)空间.有谁知道如何解决这个问题?
谢谢你的任何提示.
真诚的,约翰