[R] postscript() and levelplot() in a for loop

Wang, Yan ywang at fhcrc.org
Wed Jan 26 20:23:17 CET 2005


Dear Thomas,

It is very interesting to read FAQ 7.22. I don't see any example of
lattice/trellis graphics linked with print() statement. How should I specify
print()? Here are the actual codes I used to create the .ps file:

x=y=myaa
grid=expand.grid(x=x,y=y)
postscript(paste(./Graphs/",file[k],".ps",sep=""))
grid$z=as.vector(mymatrix)
levelplot(z~x*y,grid,at=seq(0,1,by=0.01),scales=list(cex=2),
          colorkey=list(labels=list(cex=2,at=seq(0,1,by=0.2))),
          main="mytitle")
dev.off()

Thank you for any help.

Yan

-----Original Message-----
From: Thomas Lumley [mailto:tlumley at u.washington.edu] 
Sent: Wednesday, January 26, 2005 11:01 AM
To: Wang, Yan
Cc: R-help at stat.math.ethz.ch
Subject: Re: [R] postscript() and levelplot() in a for loop

On Wed, 26 Jan 2005, Wang, Yan wrote:

> Hi,
>
>
>
> I like to produce a series of levelplot graphs in postscript file, so I
put
> the trunk of codes including postscript() and levelplot() in a for loop.
The
> codes work fine outside the loop, but only produce empty .ps file when
being
> put within the loop. Is it a problem associated with postscript() or
> levelplot()? How to get around the problem? Many thanks!
>

It's hard to be sure without seeing any code, but it sounds like you 
should look at
FAQ 7.22 Why do lattice/trellis graphics not work?

 	-thomas




More information about the R-help mailing list