[R] animation error

Yihui Xie xie at yihui.name
Thu Jun 16 21:26:07 CEST 2011


Hi,

If 100 frames can work but 730 cannot, I think this might be due to
the limit of ImageMagick. If that is the case, I do not have any
solutions from R's aspect, instead, you may want to try
GraphicsMagick, which is similar to ImageMagick. I'm not sure if it is
better than ImageMagick in terms of file size limits, though.

To use GraphicsMagick, you just need to saveMovie(..., convert = 'gm
convert') after you have installed GraphicsMagick and restarted R.

If you do not have to stick to GIF animations, I believe saveHTML() is
also a good choice.

Please let me know if this solves your problem. Thanks!

BTW, you'd better include your sessionInfo() next time.

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA



On Tue, Jun 14, 2011 at 11:06 PM, emorway <emorway at usgs.gov> wrote:
> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list