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

#7 How to make a movie of a variable change among the time? #9

Open
Cam-in opened this issue Sep 2, 2019 · 4 comments
Open

#7 How to make a movie of a variable change among the time? #9

Cam-in opened this issue Sep 2, 2019 · 4 comments

Comments

@Cam-in
Copy link

Cam-in commented Sep 2, 2019

So, let's say that we have suspended particulate matter concentration of each summer day in a specific area, how to combine each text file, plot it and see the dynamic among the pass time?

@raymondben
Copy link
Member

Are we talking about an animated plot (like a scatter plot or line chart) or an animated map? Plots can be animated with e.g. the gganimate package. Maps are not so easy with gganimate, at least last time we tried, but there are other ways to do it. I'll dig out some code if that's what you are thinking of.

@Cam-in
Copy link
Author

Cam-in commented Sep 3, 2019

Great! Yes I mean a map animated. The idea come up after seeing the seal track animated but the idea is to make it with concentration of a chemic or in this case sediment

@raymondben
Copy link
Member

OK, so last time I looked at this I got to here: https://github.com/raymondben/rrasteranim

Basically, if the data you want to animate can be put into data.frame form, then gganimate is a good approach. e.g. the seal track animation was done this way (see the code at https://raw.githubusercontent.com/ropensci/roweb2/master/content/blog/2018-11-13-antarctic.md).

Unfortunately, gganimate doesn't (or at least didn't at the time) handle rasters directly. If you try and convert a time series of raster objects into a data.frame, then (unless those rasters are very small or the time series is very short) the data.frame will be gigantic, because you have one row per pixel per time step. And everything falls in a heap.

So this was my exploration of ways around that. There may be better solutions.

@raymondben
Copy link
Member

PS @Cam-in if you send me your raster (particulate matter) data I can have a first go at it if you like

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