[R] plotting simple plot with error bars

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun Jun 16 17:18:38 CEST 2002



Timur Elzhov wrote:
> 
> Hello!
> 
> I'm novice in R, so excuse me if my question will be quite trivial.
> I look through all the demos and examples, but could not find how could I
> plot 'classical' simple graph with error bars.  That is, I have dataframe
> with 3 columns: "x", "y" and "dy" -- how can I get points (x, y) with,
> for example, short lines of length "dy" up and down from "y"?

Use segments(). Example:

 mydat <- data.frame(x=1:10, y=1:10, dy=rnorm(10))
 attach(mydat)
 plot(x, y, ylim = range(y, y + dy))
 segments(x, y, x, y + dy)

Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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