Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set slower frame rate or longer duration for gganimate

when making animation from ggplot using gganimate, I need to set a lower pace to allow people to read data.

Reading documentation (hard to find options) seems that "nframes" is the proper setting. But I can't slow the animation or set the duration. Any of both approaches would be fine

library("gganimate")
library("tidyverse")

p <- ggplot(airquality, aes(Day, Temp, color = Month)) +
  transition_time(Month) +
  labs(title = 'Month is {frame_time}') +
  geom_path(aes(group = Month), size = 1)

animate(p, nframes = 100)

Error in device(files[i], ...) : unused argument (nframes = 100)
like image 606
useRj Avatar asked Nov 29 '18 16:11

useRj


1 Answers

Not sure why you received that error, but you can set the frame rate in the animate() function call:

animate(p, nframes = 100, fps=3)
like image 84
Alan Dursun Avatar answered Sep 19 '22 15:09

Alan Dursun