[R] Re: Copying a device (former: Legend text -- discrepancy ...)

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jan 19 08:39:58 CET 2004

On Sun, 18 Jan 2004, Itay Furman wrote:

> On Thu, 15 Jan 2004, Prof Brian Ripley wrote:
> > The short answer is not to copy the device, but to replot on the new 
> > device.  That is the advice given in MASS, for example.
> >
> But these device-copy functions could have been quite handy -- 
> especially after a long sequence of plotting commands that are 
> done interactively.

Yes, and that is part of the statement I pointed you to.

> > When you copy a device, you replay the device list and hence the lines and 
> > text are placed at the positions calculated using the font metrics of the 
> > first device and not the second.  dev.copy2eps does not try to adjust the 
> > pointsize of the postscript device, and provided the fonts match you 
> > should just be able to adjust the pointsize in this case.
> > 
> OK, so I tried various things and the best I could come up with 
> is replacing [My X11() width and height defaults are 7]
> 	dev.copy2eps(file="test.eps", paper="letter")
> with
> 	dev.copy2eps(file="test.eps", paper="letter",
> 			width=8, height=8)

So you ignored the advice I gave about `pointsize'!

> Let's see if I understood what I did above:
> the physical size of the X11 and PS fonts is different. 
> Therefore, instead of changing the fontsize we re-scale the plot.
> (This is what is implied by the various printouts I have made.)
> If so, is there a way to reduce the font size, instead of  
> increasing the plot size?

Yes, and I have already given you a reference to it and told you in the 

> (To avoid the plot extending beyond the physical page, for 
> example.)
> If the only way is to change the EPS device dimensions how could 
> I do it in a more robust way?
> Is, e.g., 'width=some.factor*par("din")[1]' a sensible way?
> Is there a better way?
> Could I pre-determine some.factor?
> > You do need to be suspicious of on-screen viewers and indeed of 
> > ghostscript, for they are often not pixel-perfect and ghostscript does 
> > font substitution (it does not have Helvetica).  I would always test by 
> > printing on a postscript printer.
> > 
> Screen and print rendering were the same.

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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list