[R] animation error

emorway emorway at usgs.gov
Wed Jun 15 06:06:05 CEST 2011


Hello, 

While running the following code I encountered a bit of a funny error. 
First the code:

library(animation)
ani.options(convert = shQuote('C:/Program
Files/ImageMagick-6.7.0-Q16/convert.exe'))

plot.ani<-function() {
  for (ts in 1:730){
    dat<-read.table(paste("c:/temp/ConcProfile_",ts,".txt",sep=""),
                    header=T,sep='\t')
    
   
#tiff(paste("c:/temp/Plot_ConcProfile_sp",ts,".tif",sep=""),height=800,width=600,res=130)
   
plot(dat$Conc[1:200],rev(dat$Depth[1:200]),type="l",xlab="Conc.",ylab="Depth",
          yaxt="n",col="blue",lwd=2,xlim=c(0,120))
    axis(side=2,at=seq(0,200,by=25),labels=rev(seq(0,200,by=25)),las=1)
    axis(side=2,at=seq(0,200,by=5),labels=F,tcl=-0.25)
    text(x=110,y=200,paste("SP ",ts,sep=""))
    ani.pause()
    #dev.off()
  }
}

saveMovie(plot.ani(),movie.name="concSlug.gif",img.name="ConcProfile",interval=0.15,outdir=getwd())

#Executing: 
#"C:/Program Files/ImageMagick-6.7.0-Q16/convert.exe" -loop 0
#    -delay 15
#    C:/Users/emorway/AppData/Local/Temp/2/RtmpwH5TwA/ConcProfile1.png
#    C:/Users/emorway/AppData/Local/Temp/2/RtmpwH5TwA/ConcProfile2.png
...
#    C:/Users/emorway/AppData/Local/Temp/2/RtmpwH5TwA/ConcProfile113.png
#    C:/Users/emorway/AppData/Local/Temp/2/RtmpwH5TwA/ConcProfile114.png
#    There seems to be an error in the conversion...

The code runs without issue when I dump individual tiff images to the temp
directory (that is, I run only the for loop).  Is there a limit to the
number of frames that can be added?  If I shorten the for loop to 100 the
gif is created, if I try to run it all the way out to 730 days (as coded
above) it terminates with the rather non-descriptive error above.  Is there
an option I've overlooked?

Thanks...
Eric

--
View this message in context: http://r.789695.n4.nabble.com/animation-error-tp3598481p3598481.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list