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
> 
> ______________________________________________
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
  • ... Loke Chok Kang
  • ... Austin, Matt
  • ... Austin, Matt
    • ... Thomas Lumley
  • ... Paolo Tommasini
  • ... Наталия Титова
    • ... Spencer Graves
  • ... Martin Heller
    • ... Adaikalavan Ramasamy
  • ... YiYao_Jiang
    • ... Kevin Wang
  • ... YiYao_Jiang
  • ... YiYao_Jiang
    • ... Uwe Ligges
    • ... Gabor Grothendieck
  • ... Jean-Luc aLLARD
  • ... Yulei He
    • ... Mahbub Latif
  • ... fang lai

Reply via email to