Desmond
Desmond

Reputation: 1137

GGAnimate package not loading gif

I'm using the code straight off the official website gganimate.com

library(ggplot2)
library(gganimate)

ggplot(mtcars, aes(factor(cyl), mpg)) + 
  geom_boxplot() + 
  # Here comes the gganimate code
  transition_states(
    gear,
    transition_length = 2,
    state_length = 1
  ) +
  enter_fade() + 
  exit_shrink() +
  ease_aes('sine-in-out')

And instead of a gif animation as the output, I'm constantly getting the individual png files saved in my work directory. I want the gif/animation alone though. I don't see an additional step where we must combine these individuals png together ... could someone advise please? Thanks.

Upvotes: 1

Views: 386

Answers (2)

Paula C
Paula C

Reputation: 194

I had the same problem and once I installed the Gifski package, everything went perfect.

Upvotes: 1

Desmond
Desmond

Reputation: 1137

My Tidyverse package (which contains ggplot2, a dependent library) was 1.2.1 and after updating it to the latest version (1.3.0), the animation is now properly displayed in Viewer.

I conclude there was likely some bug with Tidyverse 1.2.1 and gganimate 1.0.4 which prevented the animation was starting.

Upvotes: 1

Related Questions