[EMAIL PROTECTED] wrote:
I am stuck on trying to get the Lattice xyplot to output a separate PNG file each time through my 'for' loop. The files get produced but are empty.
Here is the code. I'm running 1.9 on Windows. BTW is there a more efficient way of creating the separate output files than looping over the levels and subsetting?
......................................................... lev <- levels(ds$TR)
for (byvar in lev) {
file.png <- paste("u:/data/R/Scatter_CTY_HWY_CO_TR", byvar, ".png", sep="")
trellis.device( device="png", file=file.png, width=1000, height=1000, pointsize=20, bg="transparent" )
ds1 <- subset(ds, TR == byvar, select=c(CTY, HWY, CO))
xyplot( ds1$CTY ~ ds1$HWY, groups=ds1$CO, auto.key=list(space="right"), ylab="CTY", xlab="HWY")
dev.off()
} .........................................................
--Rich
Richard Kittler AMD TDG
408-749-4099
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
See the FAQ.
you have to wrap the xyplot call with a print. I.e.
for(...) {
...
print(xyplot(...))
...
}______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
