Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternatives to animating a large data set: animate() won't work #410

Closed
taraskaduk opened this issue Sep 28, 2020 · 2 comments
Closed

Alternatives to animating a large data set: animate() won't work #410

taraskaduk opened this issue Sep 28, 2020 · 2 comments

Comments

@taraskaduk
Copy link

Hi Thomas and team!
I have a large {sf} data set that I would like to animate with gganimate(), and the current workflow for the package doesn't seem to work for me.

The final animation should consist of only 24 frames, but the underlying data set if a set of simple features (road segments): 20,476 unique segments in 403,213 instances (each segment has up to 24 values, 1 for every hour of the day). In the animation, segments stay in place, only color changes (hence grouping by segment id).

The animation works as expected (using either transition_states() or transition_time()) if I select top 1000 rows, essentially visualizing a tiny fraction of the data. Trying to animate the entire data set does nothing: animate() is called, but nothing is printed to the console (the session is not unresponsive though - I am able to stop the animate() call without a problem)

So, the problem is not in the code, but in the processing a large amount of data (or the fact that this is an sf object).

Question

My question is: is there a possible workaround within the gganimate() framework that allows me to create the animation in some alternative way? ggplot can handle this data, after all: e.g. I can generate a static plot with facet_wrap() without a problem.

Workaround

As a current workaround, I have ggplot generate 24 static images, and then merge them into a gif with gifski CLI. But I'd like to do all steps within my R scripts, without a need to go to the command line and back.

Here is what I get with that workaround and would like to get with gganimate:
full

@thomasp85
Copy link
Owner

I cannot really comment on why it doesn't work if you can get all your states with facet_wrap (ie you don't need any tweening) you should be able to use transition_manual.

Another approach is to just do it all by hand and use the gifski package instead of gifski cli if you want to stay in R

@taraskaduk
Copy link
Author

taraskaduk commented Sep 29, 2020

Thank you!
I am not very familiar with gganimate syntax, and I think "no tweening" is what I was looking for, without knowing how to say it.
Will read the documentation extra carefully next time.

However,

you don't need any tweening

Well, I do, it'd be nice to have it, but it doesn't seem as if my MBP, my R session and gganimate can give it to me. I simply assume it is too heavy of a lift.

I'm going to close this issue as there is nothing to do, really.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants