Created
June 6, 2018 19:05
-
-
Save thomasp85/05169ad44ddcc8ed56da6ff7bf7fbe36 to your computer and use it in GitHub Desktop.
Gapminder example with gganimate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 "