1 min read

Graphs that Move: Fun with gganimate!

I recently learned about the gganimate package, which means…

We can make graphs that move!

The future is now, people.

My first gganimate is below.

library(ggplot2)
library(gganimate)

#read in the data
gganimate_practice <- read.csv("image_tracker.csv")

#this is the plot
gg_animate_plot <- ggplot(gganimate_practice, aes(Day, Running_Total, color=factor(Week))) +
  geom_line(size=2) +
  labs(y="Running Total", title="Image Analyses Per Day")

#now we add the animated layer to the plot
gg_animate_plot +
  transition_reveal(Day)

This post may have less text than the other posts…that’s because it speaks for itself. Also, it’s similar to this graph that I’ve made for this blog before. I just animated it because it was easy & clean sample data to explore such a fun new package. That being said, I’m planning to make even more gifs in the future, so keep checking back!