[R] Question about legend

Arne Henningsen ahenningsen at email.uni-kiel.de
Fri Feb 18 14:27:23 CET 2005


On Friday 18 February 2005 13:12, Uwe Ligges wrote:
> Arne Henningsen wrote:
> > type "?legend" (and please read the posting guide)
>
> I don't think it is that easy, but you have to tweak manually., e.g. by
> two calls to legend.
>
> Uwe Ligges

You are right, you have to call legend twice, e.g.

R> barplot(c(1:10))
R> lines(c(1:11),5*abs(sin(c(1:11))))
R> legend( 1.25, 10, c(" bar"), fill="grey", bty="n" )
R> legend( 1, 9.5, c("line"), lty=1, bty="n" )
R> rect(1,8.7,3,10)

Arne

> > On Friday 18 February 2005 11:11, Haiyong Xu wrote:
> >>Hi there,
> >>
> >>I made a plot with histogram and the curve of kernel density estimation
> >>together. The question is to add a legend to it. What I want is to use a
> >>small box with shade representing the histogram and a line representing
> >>the kernel estimation. Is there any way to implement this?
> >>
> >>Thanks a lot.
> >>
> >>Haiyong
> >>
> >>______________________________________________
> >>R-help at stat.math.ethz.ch mailing list
> >>https://stat.ethz.ch/mailman/listinfo/r-help
> >>PLEASE do read the posting guide!
> >>http://www.R-project.org/posting-guide.html
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

-- 
Arne Henningsen
Department of Agricultural Economics
University of Kiel
Olshausenstr. 40
D-24098 Kiel (Germany)
Tel: +49-431-880 4445
Fax: +49-431-880 1397
ahenningsen at agric-econ.uni-kiel.de
http://www.uni-kiel.de/agrarpol/ahenningsen/




More information about the R-help mailing list