Trying gganimate

The gganimate CRAN package “extends the grammar of graphics as implemented by ggplot2 to include the description of animation. It does this by providing a range of new grammar classes that can be added to the plot object in order to customise how it should change with time”. (Link)

I have been trying out the package’s functionality with some WBBL cricket data. I followed the very basic guidelines to produce four gifs.

I am keen to explore this package in more detail. Before I started I used the vis_dat package (link) to check the structure of my data:

My very basic code for the animations was:

ggplot(df, aes(Wicket, WTPartnership03, size=WTPartnership03)) +
geom_point(alpha = 0.7, show.legend = FALSE, colour=”blue”) +
labs(title = ‘Wicket Winning Team Partnerships WBBL03: {frame_time}’,
x = ‘Wicket’, y = ‘Proportions of Total Runs Scored Per Wicket WBBL03’) +
transition_time(Wicket) +

I used anim_save(“~/Documents”) to save the animation. This command saves the most recent animation as a gif to your specified directory. I had some problems with my x axis so tried scale_x_continuous(breaks=1:10) to resolve the issue and provide me with an integer count for the header in the gif.