Skip to content

Instantly share code, notes, and snippets.

@thomasp85
Created June 6, 2018 19:05
Show Gist options
  • Save thomasp85/05169ad44ddcc8ed56da6ff7bf7fbe36 to your computer and use it in GitHub Desktop.
Save thomasp85/05169ad44ddcc8ed56da6ff7bf7fbe36 to your computer and use it in GitHub Desktop.
Gapminder example with gganimate
library(gapminder)
library(ggplot2)
library(gganimate)
p <- ggplot(gapminder, aes(gdpPercap, lifeExp, size = pop, colour = country)) +
geom_point(alpha = 0.7) +
scale_colour_manual(values = country_colors) +
scale_size(range = c(2, 12)) +
scale_x_log10() +
facet_wrap(~continent) +
theme(legend.position = 'none') +
labs(title = 'Year: {frame_time}', x = 'GDP per capita', y = 'life expectancy') +
transition_time(year) +
ease_aes('linear')
animate(p, 100, 10)
@thomasp85
Copy link
Author

You don’t need devtools. Just the regular cran install. This is a super old conversation so don’t expect the recommendations given here to be current🙂

@lmccully10
Copy link

Huh odd, because I installed it originally through CRAN, but now when I call on the library it gives me:
"Error: package or namespace load failed for ‘gganimate’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘progress’
In addition: Warning message:
package ‘gganimate’ was built under R version 3.4.4 "

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment