[R] error bars in line plots

Volker Franz volker.franz at tuebingen.mpg.de
Mon Oct 7 12:55:10 CEST 2002


Hi, 

    >> Could you tell me how I can draw a graph with error bars?
>>>>> "KKW" == Ko-Kang Kevin Wang <Ko-Kang at xtra.co.nz> writes:
    KKW> Hi, Take a look at
    KKW> http://finzi.psych.upenn.edu/R/Rhelp02/archive/4124.html and
    KKW> its thread.

I just had a look at this page and expanded the examples a bit:

##Sample data:
mydat <- data.frame(x=1:10, y=1:10, dy=rnorm(10))
attach(mydat)

##Style of errorbars:
myangle=90  #Angle from shaft to edge of arrow head.
mylength=0.2#Length of arrow head in inches (!!!)

##One--sided errorbars:
plot(x,y,ylim=range(y,y+dy))
arrows(x,y,x,y+dy,angle=myangle,length=mylength)

##Two--sided errorbars:
plot(x,y,ylim=range(y-dy,y+dy))
arrows(x,y-dy,x,y+dy,code = 3,angle=myangle,length=mylength)

HTH
Volker
-- 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list