Documentation

contourslice

Draw contours in volume slice planes

Syntax

contourslice(X,Y,Z,V,Sx,Sy,Sz)
contourslice(X,Y,Z,V,Xi,Yi,Zi)
contourslice(V,Sx,Sy,Sz)
contourslice(V,Xi,Yi,Zi)
contourslice(...,n)
contourslice(...,cvals)
contourslice(...,[cv cv])
contourslice(...,'method')
contourslice(axes_handle,...)
h = contourslice(...)

Description

contourslice(X,Y,Z,V,Sx,Sy,Sz)draws contours in thex-,y-, andz设在对齐ed planes at the points in the vectorsSx,Sy,Sz. The arraysX,Y, andZdefine the coordinates for the volumeVand must be monotonic and represent a Cartesian, axis-aligned grid (such as the data produced bymeshgrid). The color at each contour is determined by the volumeV, which must be an m-by-n-by-p volume array.

contourslice(X,Y,Z,V,Xi,Yi,Zi)draws contours through the volumeValong the surface defined by the 2-D arraysXi,Yi,Zi. The surface should lie within the bounds of the volume.

contourslice(V,Sx,Sy,Sz)andcontourslice(V,Xi,Yi,Zi)(omitting theX,Y, andZarguments) assume[X,Y,Z] = meshgrid(1:n,1:m,1:p), where[m,n,p]= size(v).

contourslice(...,n)drawsncontour lines per plane, overriding the automatic value.

contourslice(...,cvals)drawslength(cval)contour lines per plane at the values specified in vectorcvals.

contourslice(...,[cv cv])computes a single contour per plane at the levelcv.

contourslice(...,'method')specifies the interpolation method to use.methodcan belinear,cubic, ornearest.nearestis the default except when the contours are being drawn along the surface defined byXi,Yi,Zi, in which caselinearis the default. (Seeinterp3for a discussion of these interpolation methods.)

contourslice(axes_handle,...)plots into the axes with the handleaxes_handleinstead of into the current axes (gca).

h = contourslice(...)returns a vector of handles topatchobjects that are used to implement the contour lines.

Examples

collapse all

存储矩阵X,Y,Z, andVfrom theflowdata 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 specifyingSxas a vector of nine elements,Syas an empty vector, andSzas a scalar.

Sx = 1:9; Sy = []; Sz = 0;

Draw 10 contour lines between -8 and 2 by specifyingcvalsas 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]) boxon

Set up matricesX,Y, andZusing themeshgridfunction.

x = -2:0.2:2; y = -2:0.25:2; z = -2:0.16:2; [X,Y,Z] = meshgrid(x,y,z);

UseX,Y, andZto defineVas a matrix of volume data.

V = X.*exp(-X.^2-Y.^2-Z.^2);

Return matricesXi,Yi, andZifrom thespherefunction.

[Xi,Yi,Zi] = sphere;

Draw contours through the volumeValong the surface defined byXi,Yi, andZi. Change the plot view to a 3-D view.

contourslice(X,Y,Z,V,Xi,Yi,Zi) view(3)

Introduced before R2006a

Was this topic helpful?