contour3

Creates 3D contoured surface in an axes.

Syntax

contour3(z)

contour3(x, y, z)

contour3(hAxes, ...)

contour3(..., cn)

Inputs

x, y, z
Range of the x, y, and z axes.
Type: double | integer
Dimension: scalar | vector | matrix
hAxes
Axis handle.
Type: double
Dimension: scalar
cn
Optional argument to set the number of contours, changing the number of colors in the colormap. The number of colors is limited to 32.
Type: integer
Dimension: scalar

Examples

contour3 plot example:
cla;
x=[0:0.15:2*pi];
y=x;
z=sin(x')*cos(y);
contour3(z);
colorbar;
Number of contours example:
cla;
x=[0:0.15:2*pi];
y=x;
z=sin(x')*cos(y);
contour3(z, 4);
colorbar;


Figure 1. 3D contour plot with four color levels

Comments

If there are no axes, one will be created first. If x and y are omitted, the index of the z column is used for the x coordinate and the index of the z row is used for the y coordinate. If the first argument of contour3() is an axis handle, surfaces are created in that axis.

The 'contourtype' of an axes object that contains a contoured surface is set to 'discrete'.