geom_bar(stat = "identity")
已被取代
geom_col()
7年前,但这在这里是偶然的。无论哪种情况,当您使用
position = "dodge"
,设置
width
参数将固定的宽度
每个闪避组
在x轴上。如果在某些x轴位置只有一个条,则其宽度为0.5。如果你在一个位置有两个条形图,它们加起来都是0.5(即每个条形图都是0.25)。
要更改此设置,您需要将位置指定为
position = position_dodge(preserve = "single")
ggplot(dat, aes(x = Quarter, y = Val, fill = type)) +
geom_col(width = 0.5, position = position_dodge(preserve = "single"))