如何在分组的条形图中使分组的条形更加紧密?

时间:2018-09-18 15:46:51

标签: r ggplot2

我正在用ggplot2制作分组条形图。我有这段代码...

ggplot(data = dummy,
       aes(
         fill = Geography2,
         x = Group,
         y = PunishmentRate
       )
) +
  geom_bar(
    position = "dodge",
    stat = "identity",
    width = 0.5,
    binwidth = 0
  ) +
  coord_flip() +
  geom_text(data = subset(dummy, Group == "White"),
            aes(
              label = Geography2,
              y = 0
            ),
            position = position_dodge(0.5),
            hjust = 0
  )

这就是这张图...

enter image description here

我认为在binwidth中添加geom_bar()参数会使各组之间的距离更近,但事实并非如此。我如何使各组之间的距离更近?

0 个答案:

没有答案