Adds a surface to the current scene. The surface is defined by a matrix defining the height of each grid point and two vectors defining the grid.
values corresponding to rows of
values corresponding to the columns of
matrix of heights
Material and texture properties. See
matrices of the same dimension as
Adds a surface mesh to the current scene. The surface is defined by
the matrix of height values in
z, with rows corresponding
to the values in
x and columns corresponding to the values in
y. This is the same parametrization as used in
y argument is a matrix, then it must be of the same
z, and the values in the matrix will be used for the corresponding
coordinates. This is used to plot shapes such as cylinders
where z is not a function of x and y.
If the normals are not supplied, they will be calculated automatically based on neighbouring points.
surface3d always draws the surface with the ‘front’ upwards
(i.e. towards higher
z values). This can be used to render
the top and bottom differently; see
the example below.
For more flexibility in defining the surface, use
terrain3d are synonyms.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
# # volcano example taken from "persp" # data(volcano) z <- 2 * volcano # Exaggerate the relief x <- 10 * (1:nrow(z)) # 10 meter spacing (S to N) y <- 10 * (1:ncol(z)) # 10 meter spacing (E to W) zlim <- range(y) zlen <- zlim - zlim + 1 colorlut <- terrain.colors(zlen) # height color lookup table col <- colorlut[ z - zlim + 1 ] # assign colors to heights for each point open3d() surface3d(x, y, z, color = col, back = "lines")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.