June 2016
Beginner to intermediate
1783 pages
71h 22m
English
In this recipe, we will use a special library to make a three-dimensional surface plot for the volcano dataset. The resulting plot will also be interactive so that we can rotate the visualization using a mouse to look at it from different angles.
For this recipe, we will use the rgl package, so we must first install and load it:
install.packages("rgl")
library(rgl)We will only use the inbuilt volcano dataset, so we need not load any other dataset.
Let's make a simple three-dimensional surface plot that shows the terrain of the Maunga Whau volcano:
z <- 2 * volcano x <- 10 * (1:nrow(z)) y <- 10 * (1:ncol(z)) zlim <- range(z) zlen <- zlim[2] - zlim[1] + 1 colorlut <- terrain.colors(zlen) ...
Read now
Unlock full access