persp3Drgl | R Documentation |
Functions persp3Drgl
, ribbon3Drgl
, hist3Drgl
produce perspective plots
using rgl; they are similar to functions persp3D, ribbon3D, hist3D
from package plot3D
.
Functions scatter3Drgl
, points3Drgl
, lines3D
, segments3Drgl
produce scatter plots and line plots
using rgl; they are similar to functions scatter3D, points3D, lines3D, segments3D from package plot3D
.
Functions slice3Drgl
, points3Drgl
, isosurf3Drgl
, voxel3Drgl
can
visualise volumetric (3D) data using rgl;
they are similar to functions slice3D, slicecont3D, isosurf3D, voxel3D from package plot3D
.
Functions surf3Drgl
, spheresurf3Drgl
produce surface plots
using rgl; they are similar to functions surf3D, spheresurf3D from package plot3D
.
Functions box3Drgl
, border3Drgl
, rect3Drgl
, text3Drgl
produce boxes, rectangles, texts to 3D plots
using rgl; they are similar to functions box3D, border3D, rect3D, text3Drgl from package plot3D
.
persp3Drgl(...) ribbon3Drgl(...) hist3Drgl(...) scatter3Drgl(...) points3Drgl(...) lines3Drgl(...) slice3Drgl(...) slicecont3Drgl(...) isosurf3Drgl(...) voxel3Drgl(...) triangle3Drgl(...) surf3Drgl(...) spheresurf3Drgl(...) segments3Drgl(...) image3Drgl(...) contour3Drgl(...) box3Drgl(...) border3Drgl(...) rect3Drgl(...) text3Drgl(...)
... |
arguments passed to the plotting methods of package |
The first step in 3D rgl plotting consists in calling the corresponding 3-D function from package plot3D
with argument plot
set to FALSE
.
The next step is to create a 3-D rgl plot, by calling plotrgl.
The actions of the mouse on the plots is to zoom (left, middle), and to move it (right key).
Karline Soetaert <karline.soetaert@nioz.nl>
plotdev to plot first in ordinary R graphics and then in rgl
for plotrgl to plot first in ordinary R graphics and then in rgl
cutrgl for cutting a rectangular region from the rgl plot.
## ======================================================================= ## perspective plots ## ======================================================================= persp3Drgl(z = volcano, contour = list(side = "zmax")) # ribbon, in x--direction V <- volcano[seq(1, nrow(volcano), by = 5), seq(1, ncol(volcano), by = 5)] # lower resolution ribbon3Drgl(z = V, ticktype = "detailed") hist3Drgl(z = V, col = "grey", border = "black", lighting = TRUE) ## Not run: cutrgl() # select a rectangle uncutrgl() ## End(Not run) ## ======================================================================= ## scatter points ## ======================================================================= with(quakes, scatter3Drgl(x = long, y = lat, z = -depth, colvar = mag, cex = 3)) plotdev() # plots same on oridinary device... ## ======================================================================= ## 3D surface ## ======================================================================= M <- mesh(seq(0, 2*pi, length.out = 50), seq(0, 2*pi, length.out = 50)) u <- M$x ; v <- M$y x <- sin(u) y <- sin(v) z <- sin(u + v) # alpha makes colors transparent surf3Drgl(x, y, z, colvar = z, border = "black", smooth = TRUE, alpha = 0.2) ## ======================================================================= ## volumetric data ## ======================================================================= x <- y <- z <- seq(-4, 4, by = 0.2) M <- mesh(x, y, z) R <- with (M, sqrt(x^2 + y^2 + z^2)) p <- sin(2*R) /(R+1e-3) slice3Drgl(x, y, z, colvar = p, col = jet.col(alpha = 0.5), xs = 0, ys = c(-4, 0, 4), zs = NULL, d = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.