In R, how to place error bars at each bar which is stacked?
Advertisements I know there are several answers to this question, but it’s slightly confusing to understand. I believe there are simpler codes than those explained in the current posts. location=c("L1","L2","L1","L2") y=c(5,10,12,12) cat=c("A","A","B","B") se=c(1,2,2,3) df=data.frame(location,y,cat,se) ggplot(data=df, aes(x=location , y=y, fill=cat))+ geom_bar(stat="identity", position = position_stack(reverse=T), width=0.7, size=1) + geom_errorbar(aes(ymin=y-se, ymax=y+se), position = "identity", width=0.5) When I run… Read More In R, how to place error bars at each bar which is stacked?