Search code examples
rgganimate

Slow down gganimate in R


How do I slow the plot below, down? I am trying to step through the days a bit slower. This is three years worth of data shown by day. Each day should be about 0.25 seconds.

enter image description here

The code I am using to build this plot is below:

library(tidyverse)
library(gganimate)

df_daily %>%
    ggplot(aes(longitude, latitude)) +
    geom_point(aes(alpha = a)) +
    transition_time(flu_day) +
    ease_aes('linear', interval = 0.001) +
    labs(title = 'Date: {frame_time}')

Solution

  • a <- df_daily %>%
        ggplot(aes(longitude, latitude)) +
        geom_point(aes(alpha = a)) +
        transition_time(flu_day) +
        ease_aes('linear', interval = 0.001) +
        labs(title = 'Date: {frame_time}')
    
    
    
    animate(a, 
            duration = 274, # = 365 days/yr x 3 years x 0.25 sec/day = 274 seconds
            fps  =  [pick how smooth you want],
            nframes = [...or pick it here])