[R] dev.copy legend problem

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Nov 17 20:09:57 CET 2005


That's why we recommend that you do not use dev.copy but replot on the 
target device.

Different devices have different fonts and font metrics, and so the plot 
as laid out for one will almost always not be right for the other.

According to the help page for dev.copy you cannot by default copy from 
postscript() to pdf().  Is that really what you are doing?  It seems to 
work for me once I enable copying, as those two devices do share fonts.

On Thu, 17 Nov 2005, Florence Combes wrote:

> We are facing this problem for long, and so ask for your help.
>
> We are plotting 2 graphs in a postscript device (left part -layout
> function-), and the common legend for these graphs on the right part.
> The legend in the postscript device looks ok: this is color lines with
> numbers on the right (6 columns) , see the code below:
>
>> nblock<-c(1:48)
>> leg<-paste(c(1:npin)," ",sep=" ")
>> legend(0,19,legend = leg, col=rainbow(nblock), lty=1,
> merge=TRUE,ncol=6,bty="n",cex=0.6)
>
> The problem we are facing is that we dev.copy to a pdf device and then, the
> legend doesn't look the same: numbers overlap a little lines.
>
> Has someone already encountered such a thing ?

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