我正在用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
)
这就是这张图...
我认为在binwidth
中添加geom_bar()
参数会使各组之间的距离更近,但事实并非如此。我如何使各组之间的距离更近?