R-graph-gallery icon indicating copy to clipboard operation
R-graph-gallery copied to clipboard

Error message in animation

Open KiyohikoN opened this issue 2 years ago • 1 comments

I am beginner to create animation in R. The following script which copeid from your site was run. But error message was occured as below. Could you please tell me how to fixt it?

Get data:

library(gapminder)

Charge libraries:

library(ggplot2) library(gganimate)

Make a ggplot, but add frame=year: one image per year

ggplot(gapminder, aes(gdpPercap, lifeExp, size = pop, color = continent)) + geom_point() + scale_x_log10() + theme_bw() +

gganimate specific bits:

labs(title = 'Year: {frame_time}', x = 'GDP per capita', y = 'life expectancy') + transition_time(year) + ease_aes('linear')

Save at gif:

anim_save("271-ggplot2-animated-gif-chart-with-gganimate1.gif")

Error: The animation object does not specify a save_animation method Traceback:
  1. anim_save("271-ggplot2-animated-gif-chart-with-gganimate1.gif", . animation = last_animation())
  2. save_animation(animation, filename)
  3. save_animation.default(animation, filename)
  4. stop("The animation object does not specify a save_animation method", . call. = FALSE)

KiyohikoN avatar Apr 28 '22 07:04 KiyohikoN

@JosephBARBIERDARNAL please check if original blog post works

holtzy avatar Apr 04 '24 09:04 holtzy

Hi @KiyohikoN ! Thanks for your message and sorry for the late reply!

I tried with gganimate 1.0.9 ggplot2 3.5.0 and gapminder 1.0.0, and everything works as expected (no error).

If possible, can you show the output of sessionInfo() when this error happens?

JosephBARBIERDARNAL avatar Apr 22 '24 09:04 JosephBARBIERDARNAL

Thank you for your response. I input the "anim_save("271-ggplot2-animated-gif-chart-with-gganimate1.gif") ", and then the error message was occurred as below. Attached please find the file.

animation #76.zip Error:
The animation object does not specify a save_animation method Traceback: anim_save("271-ggplot2-animated-gif-chart-with-gganimate1.gif", . animation = last_animation()) save_animation(animation, filename) save_animation.default(animation, filename) stop("The animation object does not specify a save_animation method", . call. = FALSE)

KiyohikoN avatar Apr 23 '24 01:04 KiyohikoN