在ggplot中调整图例和图之间的空间

时间:2018-08-22 21:39:44

标签: r ggplot2

我不知道如何在红色圆圈内调整此空间。什么是边距/间隔/什么?

ggplot(mtcars) +
  aes(fill=factor(cyl), x=cyl) +
  geom_bar() +
  labs(title = "ASDF") +
  theme(
    legend.justification = "left",
    legend.margin = margin(0,0,0,0),
    legend.position = "top", 
    legend.spacing = unit(0, "char"),
    legend.text = element_text(margin = margin(t=0, b=0, l=.5, r=2, unit="char")),
    legend.title = element_blank(),
    legend.box.margin = margin(0,0,0,0),
    panel.spacing = unit(0, "char"),
    plot.margin = unit(c(0,0,0,0), "char"),
  )

enter image description here

0 个答案:

没有答案