[R] geom_errorbar with ggplot2

Pedro de Barros pbarros at ualg.pt
Sat Oct 13 18:29:44 CEST 2007


Dear All,

I am trying to build an error bar plot with ggplot2. However, even if 
the code seems to work, the plot is rather odd, with what seems to be 
a continuous line linking the different bars.

I attach below the code I used, as well as the data.
================================================================
DFrame<-data.frame(x=1:10,y=0.5*(1:10),Upper=(1:10)+0.5, Lower=(1:10)-0.5)
p <- ggplot()
l1<-layer(data=DFrame, mapping=aes_string(x='x',min='Lower', 
max='Upper'), geom='errorbar', stat='identity')
p<-p + l1 + scale_y_continuous()

p

========================================
I wonder if anyone can help me with this.

Best,
Pedro de Barros



More information about the R-help mailing list