[R] How to add error bars to plot(x,y)in R?

Anne York york at noaa.gov
Fri Jan 25 16:47:48 CET 2002


Here is a very  simple function to superimpose error bars (in the
y-direction) on an existing  plot. Play with lh to get desired width. You
have to take care that the plot limits are wide enough to accomodate the
error bars.

"superpose.eb" <-
function(x,y,ebl,ebu = ebl,lh=.01,...){
 segments(x, y + ebu, x, y - ebl, ...) 
 segments(x - lh , y + ebu, x + lh , y + ebu,  ...)
 segments(x - lh , y - ebl, x + lh , y - ebl,
        ...)
}
 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Anne E. York
National Marine Mammal Laboratory
Seattle WA 98115-0070  USA
e-mail: anne.york at noaa.gov
Voice: +1 206-526-4039
Fax: +1 206-526-6615  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Anne E. York
National Marine Mammal Laboratory
Seattle WA 98115-0070  USA
e-mail: anne.york at noaa.gov
Voice: +1 206-526-4039
Fax: +1 206-526-6615
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Thu, 24 Jan 2002 mingliz2 at netscape.net wrote:

>Dear R Experts,
>
>Is there a way in R to add an error bar (say in the y direction) for each data point?  
>
>Thanks
>
>Ming Chow
>-- 
>
>
>
>
>__________________________________________________________________
>
>
>
>
>-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
>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
>_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

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