[R] Printing Lattice Graphs from Windows

Spencer Graves spencer.graves at pdf.com
Mon Jun 7 04:00:27 CEST 2004


Hi, Duncan: 

      Thanks.  It worked for me, complete with the gray background and 
pastel blue dot.  The following also worked to eliminate the (to me 
ugly) gray background, etc.: 

win.metafile()
trellis.par.set('background', list('white'))
trellis.par.set('plot.symbol',
  list(cex=0.8, col="blue", font=1, pch=1))
xyplot(1 ~ 1)
dev.off()

      Thanks again.  spencer graves

Duncan Murdoch wrote:

>On Sun, 06 Jun 2004 17:43:42 -0700, Spencer Graves
><spencer.graves at pdf.com> wrote:
>
>  
>
>>Hi, Deepayan: 
>>
>>     Following your suggestion, I tried the following in Rgui.exe: 
>>
>>    
>>
>>>xyplot(1~1)
>>>win.metafile()
>>>graphics.off()
>>>      
>>>
>>     I then switched to MS Word, pasted, and got the same blank plot as 
>>before.  (I actually tried other things as well, but came to this after 
>>reading the documentation.) 
>>    
>>
>
>You should open the device *first*.  Then you plot to it, then close
>it and the graphics are saved.
>
>That is,
>
>  
>
>>library(lattice)
>>win.metafile()
>>xyplot(1 ~ 1)
>>dev.off()
>>    
>>
>
>This worked for me in a single attempt; I haven't tested it
>thoroughly.
>
>Generally speaking, you get better graphics results by plotting to the
>final graphics device rather than plotting to the screen and copying
>somewhere, because the graphics system makes some choices based on the
>target device capabilities, and those choices might not be appropriate
>on a different device.  I notice lines are often too thin when printed
>from a plot on screen, for example.
>
>Duncan Murdoch
>  
>




More information about the R-help mailing list