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

Itay Furman itayf at fhcrc.org
Mon Jan 19 00:16:33 CET 2004

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.

> 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")
	dev.copy2eps(file="test.eps", paper="letter",
			width=8, height=8)

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?
(To avoid the plot extending beyond the physical page, for 

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.

	Many thanks,

itayf at fhcrc.org

More information about the R-help mailing list