You can use segments
to add the bars in base graphics. Here epsilon
controls the line across the top and bottom of the line.
plot (x, y, ylim=c(0, 6))
epsilon = 0.02
for(i in 1:5) {
up = y[i] + sd[i]
low = y[i] - sd[i]
segments(x[i],low , x[i], up)
segments(x[i]-epsilon, up , x[i]+epsilon, up)
segments(x[i]-epsilon, low , x[i]+epsilon, low)
}
As @thelatemail points out, I should really have used vectorised function calls:
segments(x, y-sd,x, y+sd)
epsilon = 0.02
segments(x-epsilon,y-sd,x+epsilon,y-sd)
segments(x-epsilon,y+sd,x+epsilon,y+sd)