Building a rotating 3D graph and exporting it as a GIF
When dealing with complex datasets, having the possibility to show your data in a 3D environment can be really enhancing.
This recipe will show you how to create such a plot, animate it, and export your animation as a GIF.
This recipe will leverage the
rgl package specifically developed for 3D visualizations in R:
We will also need to install ImageMagick in order to perform the export into the GIF format.
You can find instructions for software installation at http://www.imagemagick.org/script/binary-releases.php.
As an explicative dataset, we will use the
iris dataset, which is a built-in dataset available with all base R installations.