mesh

Draws a wireframe surface from a matrix of heights.

Category: Graphics > 2-D and 3-D Plots

Syntax

mesh(Z)

Plots the heights Z over the grid of column and row indices.

mesh(X, Y, Z)

Uses the coordinates X and Y, as matrices or as vectors.

mesh(X, Y, Z, C)

Colors the mesh by the values in C.

mesh(___, Name, Value)

Sets surface properties such as 'EdgeColor'.

h = mesh(___)

Also returns the surface handle.

Description

mesh connects neighboring grid points with colored lines. Use meshgrid to build X and Y from vectors, and view, colormap and colorbar to adjust the look. For solid faces use surf.

Input arguments

Z
Matrix of heights. Its size gives the number of grid lines in each direction.
X, Y
Coordinates: matrices of the size of Z, or vectors with length(X) = columns and length(Y) = rows.
C
Color data of the size of Z; by default the colors follow the height.

Output arguments

h
Handle to the surface object.

Example

The peaks surface

[X, Y, Z] = peaks(30);
mesh(X, Y, Z)
colorbar

In the app, the figure is drawn below the code.

See also

surf meshc meshz meshgrid peaks contour