[R] Error Bars

Anon. bob.ohara at helsinki.fi
Thu Nov 8 10:07:15 CET 2001


I'm trying to draw some error bars on a bar chart.  I'm using code like
this:

thing <- c(3,3,3)
se <- c(1,1,1)
names(thing) <- c("A", "B", "C")
barplot(thing, ylim=c(0,4))
arrows(c(1:3), thing-se, c(1:3), thing+se, code=3, angle=90,length=0.1)

Using c(1:3) has 2 problems: 
1. Obviously it is untidy, but using names(thing) doesn't work, and I
can't find out what will work.
2. It draws the lines in the wrong place (i.e. not in the middle of the
bars)

I'm sure this problem has a well know and obvious solution, but it's not
so well known or obvious to me.

Thanks in advance.

Bob

-- 
Bob O'Hara
Metapopulation Research Group
Division of Population Biology
Department of Ecology and Systematics
PO Box 17 (Arkadiankatu 7)
FIN-00014 University of Helsinki
Finland

NOTE: NEW TELEPHONE NUMBER
tel: +358 9 191 28779  fax: +358 9 191 28701
email: bob.ohara at helsinki.fi
To induce catatonia, visit:
http://www.helsinki.fi/science/metapop/

It is being said of a certain poet, that though he tortures the English
language, he has still never yet succeeded in forcing it to reveal his
meaning
- Beachcomber
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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