[R] ggplot2 plotting errorbars.

Pieter Coussement dencoussie at gmail.com
Mon Feb 4 00:01:00 CET 2013


Hi,
i'm using this lines of code:

dodge <-position_dodge(width=0.9)

ggplot(dfm,aes(x = X,y = value)) +
   geom_bar(aes(fill = variable), position=dodge, stat="identity") +
   geom_errorbar(aes(ymin=value-er, ymax=value+er),width=0.25, 
position=dodge,stat="identity")

to plot this data frame
                 X variable  value    er
1   A     X4  58.74  9.44
2  B     X4  52.41 10.01
3 C     X4  95.52  4.88
4  A     X1  75.51  8.54
5  B     X1   0.73 23.20
6 C     X1  96.66  1.18
7 A      X5  76.70  9.60
8 B      X5   0.56 34.50
9 C      X5 100.58 10.87

result:

As you see the error bars are still very much wrongly positioned.
How do i solve this?

thanks for the help!


More information about the R-help mailing list