Learn R Programming

OceanView (version 1.0.2)

Moving slices in 3D: Plotting volumetric data as moving slices in 3D using rgl

Description

movieslice3D plots 3D volumetric data as slices moving in one direction in open-GL graphics. It is based on the plot3Drgl function slice3Drgl.

Usage

movieslice3D (x, y, z, colvar = NULL, xs = NULL,
  ys = NULL, zs = NULL, along = NULL,
  col = jet.col(100), NAcol = "white", clim = NULL, 
  wait  = NULL, ask = FALSE, add = FALSE, 
  basename = NULL, ...)

Arguments

x, y, z
Vectors with x, y and z-values. They should be of length equal to the first, second and third dimension of colvar respectively.
colvar
The variable used for coloring. It should be an array of dimension equal to c(length(x), length(y), length(z)). It must be present.
col
Colors to be used for coloring the colvar variable. If col is NULL then a red-yellow-blue colorscheme (jet.col) will be used.
NAcol
Colors to be used for colvar values that are NA.
clim
Only if colvar is specified, the range of the color variable values. Values of colvar that extend the range will be put to NA and colored as specified with NAcol.
xs, ys, zs
Vectors specify the positions in x, y or z where the slices (planes) are to be drawn consecutively. The movie will loop over the slices, each time projecting the values of colvar on them. If all xs, ys, zs are NU
along
A number 1, 2, 3 denoting the dimension over which the slices are to be moved. If NULL, then the dimension will be the one corresponding to the longest vector xs, ys, zs.
add
Logical. If TRUE, then the slices will be added to the current plot. If FALSE a new plot is started.
ask
Logical. If TRUE, then the new slice will only be drawn after a key has been struck. If FALSE, redrawing will depend on wait
wait
The time interval inbetween drawing of a new slice, in seconds. If NULL, the drawing will not be suspended.
basename
The base name of a png file to be produced for each movieframe.
...
additional arguments passed to slice3D from package plot3D or to plotrgl from package plot3Drgl.

Value

  • returns nothing

See Also

Sylt3D for a data set that can be displayed with movieslice3D moviepoints3D for plotting moving points in 3D

Examples

Run this code
x <- y <- z <- seq(-1, 1, by = 0.1)
 grid   <- mesh(x, y, z)
 colvar <- with(grid, x*exp(-x^2 - y^2 - z^2))

 movieslice3D  (x, y, z, colvar = colvar, ticktype = "detailed")

Run the code above in your browser using DataLab