[R] printing lattice plots

Deepayan Sarkar deepayansarkar at yahoo.com
Tue Aug 14 02:06:13 CEST 2001


--- Claudia Tebaldi <tebaldi at rap.ucar.edu> wrote:
> Hi
> 
> I'm trying to print several plots to a multi-page
> postscript file. 
> Some plots are output of basic commands, some are
> produced by "trellis" 
> commands (from the package lattice). 
> Right now I'm not able to get a straightforward
> black and white color
> scheme for the latter kind: when I open the
> postscript file the "trellis"
> plots are invisible, or parts of them are (usually
> the bounding
> box/axes/axes marks). 
> 
> Here is a sample set of lines:
> 
> postscript(file="pix1.ps")
> par(mfrow=c(2,2))
> plot(X,Y)
> plot(X1,Y1)
> plot(X2,Y2)
> 
> par(mfrow=c(1,1))
> 
> bwplot(cut(X)~Y)
> bwplot(cut(X1)~Y1)
> 
> dev.off()


Mixing regular R graphics and grid/lattice graphics
are not fully supported yet (we hope to have some
support in the next release). There is a way though,
which is to use the grid functions grid.stop() and
grid.start(). You have to first start the device by
trellis.device()
(otherwise the trellis settings for that device might
not take effect). That will start grid graphics. You
might now use lattice calls. Call grid.stop() before
starting regular graphics calls and then grid.start()
again to return to lattice. For example, this should
give you what you want:


> ##postscript(file="pix1.ps")    replaced by:
> trellis.device(postscript, file="pix1.ps", 
+ color=F, bg="white")
> grid.stop()  # added
> par(mfrow=c(2,2))
> plot(X,Y)
> plot(X1,Y1)
> plot(X2,Y2)
> 
> par(mfrow=c(1,1))
> 
> grid.start() # added
> bwplot(cut(X)~Y)
> bwplot(cut(X1)~Y1)
> 
> dev.off()



> I've tried changing the trellis.settings$...$col
> items to "black"
> or specifying
> trellis.device(color=FALSE,device="postscript"). No
> luck. 
> On a related note, is there a way to have multiple
> trellis plots on a same
> page? 

print.trellis() with arguments position or split.


__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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