image
对齐标签和条形
df <- data.frame(
x = factor(c(1, 1, 2, 2)),
y = c(1, 3, 2, 1),
grp = c("a", "b", "a...(aes(label = y), position = position_dodge(0.9))
?...image
#使用你无法轻推和躲避文字,所以改为调整y位置
ggplot(data = df, aes(x, y, group = grp)) +
geom_col(aes(fill = grp),...position = "dodge") +
geom_text(
aes(label = y, y = y + 0.05),
position = position_dodge(0.9),
vjust...) +
geom_col(aes(fill = grp)) +
geom_text(aes(label = y), position = position_stack(vjust = 0.5))
?