trisurf
Triangular surface plot
Description
trisurf(
plots the surface defined by a 3-D
TO
)triangulation
or delaunayTriangulation
object.
trisurf(___,
also specifies the
surface color for either of the previous syntaxes.c
)
trisurf(___,
specifies
one or more properties of the surface plot using name-value pairs. For example,
Name,Value
)'FaceColor','y'
sets the face color to yellow.
h = trisurf(___)
returns a patch
object used to create the surface plot. Use h
to
query and modify properties of the plot. For more information, see Patch Properties.
Examples
3-D Surface Plot
Create a set of 3-D points and compute the Delaunay triangulation using the delaunay
function. Plot the surface defined by the triangulation.
[x,y] = meshgrid(1:15,1:15); z = peaks(15); T = delaunay(x,y); trisurf(T,x,y,z)
Alternatively, you can create and plot a triangulation
object.
TO = triangulation(T,x(:),y(:),z(:)); trisurf(TO)
Input Arguments
T
— Triangle connectivity
matrix
Triangle connectivity, specified as a 3-column matrix where each row contains the point vertices defining a triangle face.
x
— x-coordinates
column vector
x-coordinates, specified as a column vector.
y
— y-coordinates
column vector
y-coordinates, specified as a column vector.
z
— z-coordinates
column vector
z-coordinates, specified as a column vector.
c
— Face color
matrix
Face color, specified as a matrix of colormap indices the same size as
z
. For more information, see How Surface Plot Data Relates to a Colormap. For additional control over the surface coloring, use the
'EdgeColor'
and 'FaceColor'
name-value
pairs.
TO
— Triangulation object
triangulation
| delaunayTriangulation
Triangulation object, specified as a triangulation
or
delaunayTriangulation
object.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: trisurf(TO,'FaceColor','r')
The properties listed here are only a subset. For a complete list, see Patch Properties.
FaceColor
— Face color
[0.85 0.85 0.85]
(default) | color name | RGB triplet | 'none'
Face color, specified as the comma-separated pair consisting of
'FaceColor'
and a color name, an RGB triplet, or
'none'
.
An RGB triplet is a three-element row vector whose elements specify the intensities
of the red, green, and blue components of the color. The intensities must be in the
range [0,1]
; for example, [0.4 0.6 0.7]
. This
table lists the long and short color name options and the equivalent RGB triplet
values.
Long Name | Short Name | RGB Triplet |
---|---|---|
'yellow' | 'y' | [1 1 0] |
'magenta' | 'm' | [1 0 1] |
'cyan' | 'c' | [0 1 1] |
'red' | 'r' | [1 0 0] |
'green' | 'g' | [0 1 0] |
'blue' | 'b' | [0 0 1] |
'white' | 'w' | [1 1 1] |
'black' | 'k' | [0 0 0] |
FaceAlpha
— Face transparency
1
(default) | scalar in range [0,1]
Face transparency, specified as the comma-separated pair consisting of
'FaceAlpha'
and a scalar in the range [0,1]
. A
value of 1 is opaque and 0 is completely transparent. Values between 0 and 1 are
semitransparent.
EdgeColor
— Edge color
[0 0 0]
(default) | color name | RGB triplet | 'none'
Edge color, specified as the comma-separated pair consisting of
'EdgeColor'
and a color name, an RGB triplet, or
'none'
. The default color of [0 0 0]
corresponds to black boundaries.
An RGB triplet is a three-element row vector whose elements specify the
intensities of the red, green, and blue components of the color. The intensities must
be in the range [0,1]
; for example, [0.4 0.6
0.7]
. This table lists the long and short color name options and the
equivalent RGB triplet values.
Long Name | Short Name | RGB Triplet |
---|---|---|
'yellow' | 'y' | [1 1 0] |
'magenta' | 'm' | [1 0 1] |
'cyan' | 'c' | [0 1 1] |
'red' | 'r' | [1 0 0] |
'green' | 'g' | [0 1 0] |
'blue' | 'b' | [0 0 1] |
'white' | 'w' | [1 1 1] |
'black' | 'k' | [0 0 0] |
LineWidth
— Line width
0.5
(default) | positive numeric value
Line width, specified as the comma-separated pair consisting of
'LineWidth'
and a positive numeric value in points.
LineStyle
— Line style
"-"
(default) | "--"
| ":"
| "-."
| "none"
Line style, specified as one of the options listed in this table.
Line Style | Description | Resulting Line |
---|---|---|
"-" | Solid line |
|
"--" | Dashed line |
|
":" | Dotted line |
|
"-." | Dash-dotted line |
|
"none" | No line | No line |
Extended Capabilities
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
Usage notes and limitations:
This function accepts GPU arrays, but does not run on a GPU.
For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Distributed Arrays
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
Usage notes and limitations:
This function operates on distributed arrays, but executes in the client MATLAB®.
For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
Version History
Introduced before R2006a
See Also
patch
| surf
| tetramesh
| trimesh
| triplot
| delaunay
| triangulation
| delaunayTriangulation
Abrir ejemplo
Tiene una versión modificada de este ejemplo. ¿Desea abrir este ejemplo con sus modificaciones?
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)