The gganimate library allows to make animated plots using the ggplot2 syntax. This example comes from the github repository of the library, visit it for more explanations!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# Get data: library(gapminder) # Charge libraries: library(ggplot2) #devtools::install_github("dgrtwo/gganimate") library(gganimate) # Make a ggplot, but add frame=year: one image per year p <- ggplot(gapminder, aes(gdpPercap, lifeExp, size = pop, color = continent, frame = year)) + geom_point() + scale_x_log10() + theme_bw() # Make the animation!ç gganimate(p) # Save it to Gif gganimate(p, "#271_gganimate.gif") |
Not what you are looking for ? Make a new search ![mediatagger]
Leave a Reply
Be the First to Comment!