Skip to Main Content Skip to Search
Product Documentation

meshz - Plot a curtain around mesh plot

Alternatives

To graph selected variables, use the Plot Selector in the Workspace Browser, or use the Figure Palette Plot Catalog. Manipulate graphs in plot edit mode with the Property Editor. For details, see Plotting Tools — Interactive Plotting in the MATLAB Graphics documentation and Creating Graphics from the Workspace Browser in the MATLAB Desktop Tools documentation.

Syntax

meshz(X,Y,Z)
meshz(Z)
meshz(...,C)
meshz(axes_handles,...)
h = meshz(...)

Description

meshz(X,Y,Z) draws a curtain around the wireframe mesh with color determined by Z, so color is proportional to surface height. If X and Y are vectors, length(X) = n and length(Y) = m, where [m,n] = size(Z). In this case, (X(j), Y(i), Z(i,j)) are the intersections of the wireframe grid lines; X and Y correspond to the columns and rows of Z, respectively. If X and Y are matrices, (X(i,j)Y(i,j)Z(i,j)) are the intersections of the wireframe grid lines.

meshz(Z) draws a curtain around the wireframe mesh using X = 1:n and Y = 1:m, where [m,n] = size(Z). The height, Z, is a single-valued function defined over a rectangular grid. Color is proportional to surface height.

meshz(...,C) draws a meshz graph with color determined by matrix C. MATLAB performs a linear transformation on the data in C to obtain colors from the current colormap. If X, Y, and Z are matrices, they must be the same size as C.

meshz(axes_handles,...) plots into the axes with handle axes_handle instead of the current axes (gca).

h = meshz(...) returns a handle to a Surfaceplot graphics object.

Tips

meshz does not accept complex inputs.

A mesh is drawn as a Surfaceplot graphics object with the viewpoint specified by view(3). The face color is the same as the background color (to simulate a wireframe with hidden-surface elimination), or none when drawing a standard see-through wireframe. The current colormap determines the edge color. The hidden command controls the simulation of hidden-surface elimination in the mesh, and the shading command controls the shading model.

Examples

Generate a curtain plot for the peaks function using meshz

figure
[X,Y] = meshgrid(-3:.125:3);
Z = peaks(X,Y);
meshz(Z);

 

Specifying axes limits for the graph

figure;
meshz(X,Y,Z);
axis([-3 3 -3 3 -7 9]);

 

Specifying a color matrix

C = gradient(Z);
figure;
meshz(X,Y,Z,C);

See Also

axis | caxis | colormap | contour | hidden | hold | mesh | meshc | meshgrid | shading | surf | surface | surfc | surfl | view | waterfall

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS