[R] error bars

Emmanuel Paradis paradis at isem.univ-montp2.fr
Tue Jul 27 10:35:49 CEST 1999


At 13:13 26/07/99 -0700, you wrote:
>How does one add error bars to an XY plot?  I looked but could not find
>anything about this.  (I'm sure I just missed something simple)
>
>Regards,
>
>--
>Bryan Van de Ven

Bryan,

I met the problem recently. It's quite simple actually. I have "file" which
contains 3 columns: lag, ccc, and ci. The last one is 1.96*se(ccc), then
the following does the trick:

	dat <- read.table("file")
	lag <- dat$V1
	ccc <- dat$V2
	ci <- dat$V3
	plot(lag, ccc)
	segments(lag, ccc+ci, lag, ccc-ci)

I also added this to draw small horizontal bars at the ends of the vertical
bar:

	segments(lag-.05, ccc-ci, lag+.05, ccc-ci)
	segments(lag-.05, ccc+ci, lag+.05, ccc+ci)

Emmanuel
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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