[R] Legend in plot: symbol for mean and standard deviation

Anne York york at noaa.gov
Tue Feb 25 17:11:03 CET 2003


You can specify that no plot character is drawn using pch = -1. 

Maybe this is what you want:

plot(1:10,1:10)
legend(locator(1),c("blah","blahblah","blahblahblah","blah..."),
 pch = c(-1,-1,22,22),lty=c(1,1,0,0),col=c("green","red","blue","blue"),
 pt.bg=c("white","white","yellow","orange"))
 


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



Date: Mon, 24 Feb 2003 18:51:35 +0100
From: Uwe Ligges <ligges at statistik.uni-dortmund.de>
To: Marco Kienzle <m.kienzle at marlab.ac.uk>
CC: r-help at stat.math.ethz.ch
Subject: Re: [R] Legend in plot: symbol for mean and standard deviation



Marco Kienzle wrote:
> 
> Dear list,
> 
> I am facing the following problem with the legend of a plot that display
> the mean and variance of a measurement y as a function of x, the mean
> being represented by a dot and the variance by a vertical line.

At least for me the latter does not appear to be "that common" ...

> My problem is that I am unable to display the symbol (dot + vertical
> line) in the legend.
> 
> any help is welcome,
> thanks
> marco


Does the following do what you are looking for?

  legend(..., c("y.", "y|"))
or
  legend(..., expression(y[.], y["|"]))


Uwe Ligges




More information about the R-help mailing list