contourz

Make a contour plot in the xy-plane at a specific height.
3.5K Downloads
Updated 30 May 2003

No License

CONTOURZ Contour plot.
CONTOURZ(Z) is a contour plot of matrix Z treating the values in Z
as heights above a plane. A contour plot are the level curves
of Z for some values V. The values V are chosen automatically.
CONTOURZ(X,Y,Z) X and Y specify the (x,y) coordinates of the
surface as for SURF.
CONTOURZ(Z,N) and CONTOURZ(X,Y,Z,N) draw N contour lines,
overriding the automatic value.
CONTOURZ(Z,V) and CONTOURZ(X,Y,Z,V) draw LENGTH(V) contour lines
at the values specified in vector V. Use CONTOURZ(Z,[v v]) or
CONTOURZ(X,Y,Z,[v v]) to compute a single contour at the level v.
Use CONTOURZ(X,Y,Z,[v v],height) to draw at the z value 'height'.
[C,H] = CONTOURZ(...) returns contour matrix C as described in
CONTOURC and a column vector H of handles to LINE or PATCH
objects, one handle per line. Both of these can be used as
input to CLABEL. The UserData property of each object contains the
height value for each contour.

The contours are normally colored based on the current colormap
and are drawn as PATCH objects. You can override this behavior
with the syntax CONTOURZ(...,'LINESPEC') to draw the contours as
LINE objects with the color and linetype specified.

Uses code by R. Pawlowicz to handle parametric surfaces and
inline contour labels.

Example:
[x,y]=meshgrid(-4:0.2:4,-4:0.2:4);
z=sin(sqrt(x.^2+y.^2)).^2;
surfl(x,y,z);
hold on;
contourz(x,y,z,'',-2);
contourz(x,y,z,[0.01 0.05 0.1 0.13],3);
hold off;


See also CONTOUR, CONTOUR3, CONTOURF, CLABEL, COLORBAR.

Cite As

Schuberth Schuberth (2024). contourz (https://www.mathworks.com/matlabcentral/fileexchange/3500-contourz), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R12.1
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Contour Plots in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0