Skip to Content
RStudio for R Statistical Computing Cookbook
book

RStudio for R Statistical Computing Cookbook

by Andrea Cirillo
April 2016
Beginner to intermediate content levelBeginner to intermediate
246 pages
5h 20m
English
Packt Publishing
Content preview from RStudio for R Statistical Computing Cookbook

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.

Getting ready

This recipe will leverage the rgl package specifically developed for 3D visualizations in R:

install.packages("rgl")
library(rgl)

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.

The iris

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical Data Analysis Using Jupyter Notebook

Practical Data Analysis Using Jupyter Notebook

Marc Wintjen

Publisher Resources

ISBN: 9781784391034Supplemental Content