[R] Problem with copying legends

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Tue Jul 30 14:06:50 CEST 2002


On Tue, 30 Jul 2002, Frank Gerrit Zoellner wrote:

> Hi!
>
> I have a problem using the legend command.
> I typed as follows:
>
>  plot(foo bar...)
>  legend(0.6,10, c("True Positiv", "False Positive", "False Negative","True Negative"), col = c("black",2,3,4),lty=c(1,1,1,1),pch=c(0,0,0,0), merge = TRUE, bg='gray90')
>
> The plot and its legend is displayed ok. The I apply a dev.cop2eps on it
to save the graphic. Then I start gv to view the resulting file.
But now, the legend text moves outside its box.
> This seems strabge to me and I have no idea why this happens.

The solution is to plot directly on a postscript() device.

It happens because the screen device (X11) and postscript() have different
font metrics (and font size will be rounded by each, too).  Copying
graphs containing text from one device to another is an approximate
business.

> I use R 1.4.1 under OSF4.

Two versions old, so well worth upgrading.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

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