Im trying to use the caTools package to combine multiple plots into a gif.
My basic code looks like :
for( i in 1:100){ plot(....) // plots few points and lines, changes slightly with each i }
I would like to combine these to a gif to see the "evolution" of the plot.
However for write.gif() from caTools, I need to give an image as an input. For each i, how do I convert the plot into an image without
- saving to disc as an intermediate step
- depending on ImageMagick or similar external dependencies.
Please feel free to point out if this is a duplicate. [ Creating a Movie from a Series of Plots in R doesnt seem to answer this ]
EDIT: Basically this requires us to convert a plot to a matrix. Since this very likely happens every time someone saves a plot, it should not be very difficult. However Im not able to get hold of how to exactly do this.