Skip to Main Content Skip to Search
Product Documentation

trisurf - Triangular surface plot

Syntax

trisurf(Tri,X,Y,Z,C)
trisurf(Tri,X,Y,Z)
trisurf(tr)
trisurf(...'PropertyName',PropertyValue...)
h = trisurf(...)

Description

trisurf(Tri,X,Y,Z,C) displays triangles defined in the m-by-3 face matrix Tri as a surface. Each row of Tri defines a single triangular face by indexing into the vectors or matrices that contain the X, Y, and Z vertices. The color is defined by the vector C.

trisurf(Tri,X,Y,Z) uses C=Z so color is proportional to surface height.

trisurf(tr) displays the triangles in a TriRep triangulation representation. It uses C = TR.X(:,3) so surface color is proportional to height.

trisurf(...'PropertyName',PropertyValue...) specifies additional patch property names and values for the patch graphics object created by the function.

h = trisurf(...) returns a patch handle.

Examples

Create vertex vectors and a face matrix, then create a triangular surface plot.

[x,y]=meshgrid(1:15,1:15);
tri = delaunay(x,y);
z = peaks(15);
trisurf(tri,x,y,z)

If the surface is in the form of a TriRep triangulation representation, plot it as follows:

tr = TriRep(tri, x(:), y(:), z(:));
trisurf(tr)

See Also

delaunay | DelaunayTri | patch | surf | tetramesh | trimesh | triplot | TriRep

  


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