DataGIFs: Animate Your Visualizations for Fun and Clarity
After running into this neat experiment with animation and ggplot tucked away in one of Hadley Wickham’s wikis, I decided to try my hand at some data animations in the form of GIFs.
With the help of the animation package, it’s easy to write a loop that creates the plots for your animation, and have R handle getting every frame in the right order and saving the file. I tried this out on a dataset of European urban populations between 1500 and 1800 as a way to animate the shift in population share from Italian cities to northern centers in Paris, Amsterdam, and London.
Moreover, looping animation makes perfect sense for our purposes. While I might want to show detailed still images when doing a more lengthy presentation of results, here there is just a simple point I need to get across via comparison of 6 different maps. With the loop, the audience doesn’t need to catch all of it the first time. Instead, as they are used to doing with GIFs, they can watch the entire animation several times in a few seconds and register the population shift being shown.
I’ve also been interested in using animation to elucidate how I arrive at some of the visualizations I show. The idea of stochastic simulation — a simulation with an element of chance — is certainly novel for most humanists. By running a stochastic simulation multiple times, we can chart the distribution of values that simulation might return. Instead of just showing the finished product, I can also animate the process of arriving at that final visualization. The GIF provides a visual explanation that can be seen in parallel with my spoken explanation, making it easier to progress from methodology discussion onto results and analysis.