I am trying to use the following snippet in my knitr document that creates pdf
<<animate_gg,fig.show='animate', eval=TRUE>>= gg.list<-list() for (w.it in w.vals){ sub.final.pts.lf.logical<-all.final.pts.lf$w %in% w.it sub.final.pts.lf<- all.final.pts.lf[sub.final.pts.lf.logical,] levels(sub.final.pts.lf$w)<- paste("w=",levels(sub.final.pts.lf$w)) g1<-ggplot(sub.final.pts.lf,aes(x=x,y=y,colour=pt.name))+geom_point(alpha = 1/5) +scale_shape(solid = FALSE) gg.list<-c(gg.list,list(g1)) } for (gg in gg.list){ gg }
however, this does not create any relevant section in latex. I assume the problem is that if I use gg inside brackets, R does not evaluate this line. The following creates a single graph animation
{ g1<-ggplot(sub.final.pts.lf,aes(x=x,y=y,colour=pt.name))+geom_point(alpha = 1/5) +scale_shape(solid = FALSE) } g1
How to create an animation with all created charts?
source share