As you may remember, a few weeks ago we had an article describing how most people using ProtonDB have moved away from using Ubuntu in the past few years (based on ProtonDB reports), mostly in favor of Arch-based distros (Arch and Manjaro taking the lead). The article did very well, audience-wise, but I must admit that the graph takes a few minutes to understand properly. So for the past week or so, I have been working to produce an animation instead, that would hopefully make it more tangible and also more fun to watch.
The underlying data is the same. But making an animation is a lot more involved. First, let me share with you the end result:
(You can also check it out on Peertube)
So, how did I produce it?
The secret sauce is a mix of:
- R programming
- a pinch of data preparation
- ggplot2 library
- gganimate library
gganimate is a library that helps produce and compress animations (using ffmpeg or other executables) out of static images. The static images are first produced by ggplot2 (one of the key graphing libraries used with R), and you then decide how you calculate the transition between each “state” of your animation, with transition functions from gganimate. After that, it’s a matter of letting the machine run - a 60s video at 60 fps (ideal for smoothness) will require 3600 frames as you might expect, and it’s a 20-30 minutes job.
The final code is actually relatively short, but getting it right took numerous iterations, I found one stackoverflow post really helpful to get me on the right track - anyone trying to reproduce this may find it a good pointer as well. When prototyping you can start with shorter videos (20s, 20 fps) so that you can shorten the wait time between each iteration.
If there’s enough interest in seeing the actual (R) code, I can make it public relatively quickly. Let me know in the comments if you want it!