I am trying to use the following chunk in my knitr document that creates a 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 doesn't create any corresponding section in latex. I assume the problem is that if I use gg
inside brackets, R doesn't evaluate that line.The following creates the animation with one plot
{
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 do I create an animation with all of the created plots?
The top FAQ (7.22) for grid-based graphics: print(gg)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With