The following code produces an image:
library(latticeExtra)
x=runif(40)
y=runif(40)
z=runif(40)
png(filename=paste(i,".png",sep=""))
levelplot(z ~ x + y, panel = panel.levelplot.points, col.regions = rainbow(50))
dev.off()
But the following code does not. Why?
library(latticeExtra)
for(i in seq(1,5)) {
x=runif(40)
y=runif(40)
z=runif(40)
png(filename=paste(i,".png",sep=""))
levelplot(z ~ x + y, panel = panel.levelplot.points, col.regions = rainbow(50))
dev.off()
}
lattice
plots, I believe that you have to explicitlyprint
them to save them in a loop. e.g.latPlot <- levelplot(...); print(latPlot)
– Streetcar