Crafting animated plots with tweenr
Package tweenr
package is another creation from Thomas Lin Pedersen. It works works well with gganimate
, making it easier to interpolate your data between different states. With this package, a higher level of customization can be achieved with much less effort, and the possibilities are nothing but amazing.
Note
There are mainly three functions used to create animations with tweenr
, and this recipe introduces the most versatile of them all, tween_elements
. It basically works with the data set by setting three roles to variables: time, id, and ease.
The following example does bear no meaning but the final result is very funny and shows what tweenr
is capable of doing.
Getting ready
Package animation is sort of a requirement for both gganimate
and tweenr
. The last two packages work well together, so gganimate
will also be requested:
> if(!requrie(animation)){install.packages('animation')} > if(!require(devtools)){install.packages('devtools')} > if(...