对于物种“ x”和“ y”的每个平均值,我必须遵循具有置信区间“ ci_min”和ci_max的数据框。如何在条形图上手动添加置信区间?
data <- data.frame("sp" = c("x","y"), count = c(-4.011, 2.45), "ci_min" = c(-4.2,1.68), "ci_max" = c(-4.01, 3.28))
library(ggplot2)
ggplot(data, aes(x = sp, y = counts, fill = sp)) +
stat_summary(geom="bar", fun.y=mean, position = "dodge")