I need to do exactly the graph that has been made on this page (the second one) http://www.animatedgraphs.co.uk/line.html
Here is my actual code :
timemax<-151737 # number of frames (and observations - so no interpolation needed) setwd("C:/Users/victo/Downloads/ffmpeg/ffmpeg/bin/") vis<-100 # how many time points are on the screen at one time gdata<-data.frame('Temps'= data$time,'RH_Xacc'= data$RH_Xacc) gname<-paste("g",1:timemax,".tif", sep="") # holds the names of the picture files right<-(((1:timemax)<=vis)*100)+(((1:timemax)>vis)*1:timemax) # rightmost time on screen left<- right-vis+2 # leftmost time on screen leftlab<-200*ceiling((left-1)/200) # leftmost x label rightlab<-200*floor(right/200) # rightmost x label # draw graphs for (i in 1:timemax) { tiff(gname[i],width=480) plot(gdata$Temps[right[i]:left[i]],gdata$RH_Xacc[right[i]:left[i]],col="red",type="l",ylim=c(-100,200),xlim=c(right[i],left[i]),xaxt="n",ylab="",xlab="time") axis(1,at=seq(from=rightlab[i],to=leftlab[i],by=12)) lines(gdata$Temps[right[i]:i],gdata$RH_Xacc[right[i]:i]) dev.off(dev.cur()) } # call FFMPEG and make the video shell("C:/Users/victo/Downloads/ffmpeg/ffmpeg/bin/ffmpeg.exe -codecs -i g%d.tif -b:v 2048k gdata.mpg",mustWork=FALSE) My code seems to work until the shell function. I don't get an error. The code just never stops running. I am not able to get the video with all the data. Can someone tell me where is the problem ? How can I get the video or if there is an other to get the same result ? I've tried the library gganimate but i didn't succeed either... I am doing this in Rstudio and using sweave.
Thanks a lot