slice

Draws slice planes through volumetric data.

Category: Graphics > 2-D and 3-D Plots

Syntax

slice(X, Y, Z, V, xslice, yslice, zslice)

Draws slices of V at the given x, y and z positions.

slice(V, xslice, yslice, zslice)

Uses the array indices as coordinates.

h = slice(___)

Also returns the surface handles.

Description

Each slice is a surface colored by interpolating V at its points, so the colors follow the current colormap. Slices can be planes parallel to the axes, as here, or any surface passed instead of the position vectors.

For a quick look inside a 3-D field, combine slice with colorbar and view(3).

Input arguments

X, Y, Z
Coordinate arrays of the same size as V, such as those from meshgrid.
V
3-D array of values.
xslice, yslice, zslice
Vectors of positions where slices are cut. Use [] for none along a direction.

Output arguments

h
Handles of the slice surfaces.

Example

Three planes through a scalar field

[x, y, z] = meshgrid(-2:0.5:2);
v = x.^2 + y.^2 + z.^2;
slice(x, y, z, v, 0, 0, 0)
colorbar
view(3)

In the app, the figure is drawn below the code.

See also

meshgrid surf contourslice isosurface colorbar