no plots in for loop (was RE: [R] (no subject))

Liaw, Andy andy_liaw at merck.com
Sun Sep 26 22:14:04 CEST 2004


1. Please use a meaningful subject, as the Posting Guide asked you to.

2. You need to wrap xyplot() (or any other lattice plotting functions) in
print().  I believe this is in the FAQ.

Andy

> From: Martin Heller
> 
> 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
> 
>




More information about the R-help mailing list