Share the Gallery !Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

Creating animated graphics can be interesting to present your data. A famous example is the Hans Rosling’s talk concerning countries evolution. There are several

way to do it with R. All solutions relies on the same method: creating several images and transform them to a .gif using ImageMagick. Here are a few

examples of what you can get. Note that the gganimate library highly simplify the process and that the tweenr package is useful to create smooth animation.

 

Sponsors


 

ImageMagick


Image Magick is a software that allows to work with images using command lines. You can create and output a set of images doing a loop in R. Then, give all these images to Image magick and it will convert them into a .gif format.

GGanimate


The gganimate library is a ggplot2 extension created by David Robinson that allows to easily create animation from your data. Basically it allows to use the frame (the step in the animation) as another aesthetic.

TweenR


The tweenR library by Thomas Lin Pedersen allows to interpolate your data between different states. It is particularly handy for animation since it allows to go from one state to another using a multitude of images, thus making a smooth animation. Once you have interpolated your data, you can use gganimate or imagemagick to create your animation as shown above.

Related