gganimate - how to extract the interpolated data used to generate frames?

I'm unclear on how to extract the dataframes containing the data used to create each frame in a gganimate animation.
I found this post on stack overflow that talks about saving each frame locally, but nothing about the data in the frame. r - How to save frames of gif created using gganimate package - Stack Overflow

It would be great if someone could provide an example, the wording below is confusing for me. what is meant by a label variable ? specifically the 'data' variable which contains the list of dataframes, how to access this list?

image

the wording you posted is about 'label variables' i.e. your ability to have labels drawn on your plot, and the information they can display. i.e. Getting Started • gganimate

gganimate doesnt support exporting the per frame position data; you can go to the github for gganimate and ask for it as a feature.

In advance of that ; You can hack your way towards seeing the data by something like

library(gganimate)

# edit how gganimate works in your session
trace(gganimate:::animate.gganim,edit = TRUE)
#after line 21 where plot is assigned; add in return(plot$data)

anim <- ggplot(mtcars, aes(mpg, disp)) +
  geom_point(aes(color = gear)) +
  transition_states(gear, transition_length = 2, state_length = 1) +
  enter_fade() +
  exit_fade()

(my_plot_data <- anim)

the default print method, shows me per frame data which implies its possible to access it as data; yet it would probably take some more work to dig out how the print method works so I wont look into that further at this time

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.