1) Read the posting guide http://www.R-project.org/posting-guide.html
which tells you to
a) use a meaningful subject line
b) give a reproducible example. I cannot find plotData and there is a
syntax error (comma after the xyplot line).
2) The following example works fine for me
for(i in 1:20){
sF<-paste("fig",i,".jpeg",sep="")
jpeg(file=sF,width=600,height=500,quality=100,pointsize=12)
plot( rnorm(100) )
graphics.off()
}
3) Try replacing graphics.off() with dev.off(). From
help("graphics.off") :
'dev.off' shuts down the specified (by default the current)
device. 'graphics.off()' shuts down all open graphics devices.
4) If you use postscript or pdf, you can have multiple graphs in one
document. E.g.
postscript(file="aaa.ps")
for(i in 1:20){
plot( rnorm(100) )
}
dev.off()
On Sun, 2004-09-26 at 21:04, Martin Heller wrote:> Hello R help mailing list,
> I'm having difficulty saving a series of figures in an
> analysis. I have attempted to save them in a for loop with
> the following code:
>
> for(i in 1:20){
> sF<-paste("fig",i,".jpeg",sep="")
> jpeg(file=sF,width=600,height=500,quality=100,pointsize=12)
> attach(plotData)
> xyplot(CHC~1:13),
> detach(plotData)
> graphics.off()
> }
>
> If I break apart the for loop and write the code 20 times,
> the images save correctly. When I run the for loop the
> saved images are blank. Any help would be greatly
> appreciated,
> Martin
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>