Closed devktpx closed 3 years ago
Please try the following:
library(gapminder)
library(gganimate)
library(gifski)
## standard ggplot2
myPlot <- ggplot(gapminder, aes(gdpPercap, lifeExp, size = pop, colour = country)) +
geom_point(alpha = 0.7, show.legend = FALSE) +
scale_colour_manual(values = country_colors) +
scale_size(range = c(2, 12)) +
scale_x_log10() +
# Here comes the gganimate specific bits
labs(title = 'Year: {frame_time}', x = 'GDP per capita', y = 'life expectancy') +
transition_time(year) +
ease_aes('linear')
animate(myPlot, duration = 5, fps = 20, width = 200, height = 200, renderer = gifski_renderer())
anim_save("output.gif")
ismirsehregal, that worked for me, thanks!
Worked for me too. Why has it taken nearly 2 hours to find a solution to this problem? Seems like this is a really cool package but still serious implementation problems.
This worked perfectly. Thanks!
I'm really struggling with animate
...I copied the plot above exactly (and have attempted multiple other ggplots) and cannot bypass this error:
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘animate’ for signature ‘"gganim"’
I'm using the most updated version of gganimate (1.0.5 not 1.0.3).
Here is a simplified example:
[## standard ggplot2
myPlot <- ggplot(gapminder, aes(gdpPercap, lifeExp, size = pop, colour = country)) +
geom_point(alpha = 0.7, show.legend = FALSE) +
# Here comes the gganimate specific bits
transition_time(year) +
ease_aes('linear')
animate(myPlot, duration = 5, fps = 20)
myPlot works fine - ‘myPlot‘ renders a fine animation. Adding ‘animate‘ leads to the error.
The reply to the initial post states to include library(gifski)
. Such info doesn't appear to be in the gganimate::anim_save()
docs nor the Getting started docs. It would be helpful to include such information, given all of the confusion on this topic, which is on display above.
Hi, When I save with the anim_save(), the gif does not reproduce, it is static like a common image.
Hi, I have trouble saving gganimate animations. It would be great if anyone could help.
This is the code I'm trying to compile:
It runs fine without the last line. However, when I add the last line (anim_save), then I get this error:
Error: The animation object does not specify a save_animation method
Here is my Session Info:
Does anyone know, why the error occurs and how I can fix this?