Draw contours in volume slice planes
h = contourslice(...)
contourslice(X,Y,Z,V,Sx,Sy,Sz) draws contours in the x-, y-, and z-axis aligned planes at the points in the vectors Sx, Sy, Sz. The arrays X, Y, and Z define the coordinates for the volume V and must be monotonic and represent a Cartesian, axis-aligned grid (such as the data produced by meshgrid). The color at each contour is determined by the volume V, which must be an m-by-n-by-p volume array.
contourslice(...,'method') specifies the interpolation method to use. method can be linear, cubic, or nearest. nearest is the default except when the contours are being drawn along the surface defined by Xi, Yi, Zi, in which case linear is the default. (See interp3 for a discussion of these interpolation methods.)
contourslice(axes_handle,...) plots into the axes with the handle axes_handle instead of into the current axes (gca).
h = contourslice(...) returns a vector of handles to patch objects that are used to implement the contour lines.
Store the matrices X, Y, Z, and V from the flow data set.
[X,Y,Z,V] = flow;
Create nine contour plots in the y-z plane, no plots in the x-z plane, and one plot in the x-y plane by specifying Sx as a vector of nine elements, Sy as an empty vector, and Sz as a scalar.
Sx = 1:9; Sy = ; Sz = 0;
Draw 10 contour lines between -8 and 2 by specifying cvals as a 10-element vector of linearly spaced values between -8 and 2.
cvals = linspace(-8,2,10);
Create the contour slice plots and set the axis limits. Set the data aspect ratio, change the camera position, and display the black box outline.
figure contourslice(X,Y,Z,V,Sx,Sy,Sz,cvals) axis([0,10,-3,3,-3,3]) daspect([1,1,1]) campos([0,-20,7]) box on
Set up matrices X, Y, and Z using the meshgrid function.
x = -2:0.2:2; y = -2:0.25:2; z = -2:0.16:2; [X,Y,Z] = meshgrid(x,y,z);
Use X, Y, and Z to define V as a matrix of volume data.
V = X.*exp(-X.^2-Y.^2-Z.^2);
Return matrices Xi, Yi, and Zi from the sphere function.
[Xi,Yi,Zi] = sphere;
Draw contours through the volume V along the surface defined by Xi, Yi, and Zi. Change the plot view to a 3-D view.