Home > Blockchain >  geom_density_2d_filled and gganimate: cumulative 2D density estimate animation over time?
geom_density_2d_filled and gganimate: cumulative 2D density estimate animation over time?

Time:12-22

This is a follow-up question of sorts to gganimate animation with all frames being a clean slate

CodePudding user response:

To get cumulative figures the easiest way is to repeat each month's data in future months.

Using the tidyverse, add the following statement before you define p...

points <- points %>% 
  mutate(monthly = map(monthly, ~seq(., max(monthly), by = "month"))) %>% 
  unnest(monthly)

Note that a cumulative density will not necessarily increase over time - if you want an animation that steadily increases you might want to add contour_var = "count" to your geom_density... term.

  • Related