R-graph-gallery
R-graph-gallery copied to clipboard
Error message in animation
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")
- 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)
@JosephBARBIERDARNAL please check if original blog post works
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?
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)