[Rd] legend() in a multiple figure environment

Mathieu Ribatet mathieu.ribatet at epfl.ch
Thu Jan 8 12:14:53 CET 2009


Dear Simone,

Did mean that the legend (text and/or box) overlap with the Normal 
density? If so then I think there's no problem as the legend is placed 
where you told R to do. And R won't check (for you) if it will overlap 
or not with pre-existing graphical elements.

On my computer, I got the expected results - if I understood correctly 
your issue though. For information:

    R version 2.8.1 (2008-12-22)
    Linux mathieu-laptop 2.6.27-11-generic #1 SMP Fri Dec 19 16:29:52
    UTC 2008 i686 GNU/Linux (Ubuntu Intrepid)

Cheers,
Mathieu

Simone Giannerini a écrit :
> Dear all,
>
> there seems to be a problem with displayed legends when a multiple
> figure environment is used, see the following example:
>
> par(mfrow=c(1,2))
> curve(dnorm,col=4,from=-4,to=4);
> legend(-4,0.3,legend="curve",lty=1,col=4)
> legend(-4,0.2,legend="curve",lty=1,col=4)
>
>
> On my machines the first time the command legend() is issued the
> legend box stretches over the curve. Subsequent calls to legend seems
> to produce a correct box instead.
>
> openSuse 11.0
>
> platform       x86_64-unknown-linux-gnu
> arch           x86_64
> os             linux-gnu
> system         x86_64, linux-gnu
> status         Patched
> major          2
> minor          8.1
> year           2009
> month          01
> day            07
> svn rev        47501
> language       R
> version.string R version 2.8.1 Patched (2009-01-07 r47501)
>
> I see this on the same version of R on Windows VISTA 32 bit as well; I
> do not see this behaviour on a machine with R 2.8.0.
>
> Thank you,
>
> Simone
> --
> ______________________________________________________
>
> Simone Giannerini
> Dipartimento di Scienze Statistiche "Paolo Fortunati"
> Universita' di Bologna
> Via delle belle arti 41 - 40126  Bologna,  ITALY
> Tel: +39 051 2098262  Fax: +39 051 232153
> http://www2.stat.unibo.it/giannerini/
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>   

-- 
Institute of Mathematics
Ecole Polytechnique Fédérale de Lausanne
STAT-IMA-FSB-EPFL, Station 8
CH-1015 Lausanne   Switzerland
http://stat.epfl.ch/
Tel: + 41 (0)21 693 7907



More information about the R-devel mailing list