rggplot2gifgganimate

Animate a MWE GIF in R


Could you please tell me why this MWE of an animated GIF, compiled in R, does not animate?

library("ggplot2")
library("gifski")
library("gganimate")
library("dplyr")
library("lubridate")

animate(ggplot(tribble(
~time,          ~y,
"2020-01-01",   2,
"2020-02-01",   4,
"2020-03-01",   3
) %>% mutate(time = as.numeric(ymd(time)))) +
    geom_line(aes(x=time, y=y)) +
    transition_time(time),
    renderer = gifski_renderer(file = "test.gif"))

The result is a still

Still GIF


Solution

  • Changing transition_time() to transition_reveal() produced a result.

    Moving GIF