[Solved] Adding standard deviation to barplot() in R


with base R, you can use the function arrows() :

barCenters <- barplot(height = Ymeans12stdev$mean,
                      main = "Average Time per Group", xlab = "Group", ylab = "Time")
arrows(barCenters, Ymeans12stdev$mean-Ymeans12stdev$sd,
       barCenters, Ymeans12stdev$mean+Ymeans12stdev$sd,angle=90,code=3)

the argument angle=90 specifies to draw “flat” arrows (i.e. a horizontal bar on top of a vertical one) and the argument code=3 specifies to draw arrows on both ends of the vertical line. You can add the argument length to increase/reduce the size of the horizontals bars of the arrows.

solved Adding standard deviation to barplot() in R