<html lang="en"> <head> <title>Plotting the Triangulation - GNU Octave</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="GNU Octave"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Delaunay-Triangulation.html#Delaunay-Triangulation" title="Delaunay Triangulation"> <link rel="next" href="Identifying-Points-in-Triangulation.html#Identifying-Points-in-Triangulation" title="Identifying Points in Triangulation"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Plotting-the-Triangulation"></a> <p> Next: <a rel="next" accesskey="n" href="Identifying-Points-in-Triangulation.html#Identifying-Points-in-Triangulation">Identifying Points in Triangulation</a>, Up: <a rel="up" accesskey="u" href="Delaunay-Triangulation.html#Delaunay-Triangulation">Delaunay Triangulation</a> <hr> </div> <h4 class="subsection">30.1.1 Plotting the Triangulation</h4> <p>Octave has the functions <code>triplot</code>, <code>trimesh</code>, and <code>trisurf</code> to plot the Delaunay triangulation of a 2-dimensional set of points. <!-- triplot scripts/plot/triplot.m --> <p><a name="doc_002dtriplot"></a> <div class="defun"> — Function File: <b>triplot</b> (<var>tri, x, y</var>)<var><a name="index-triplot-2782"></a></var><br> — Function File: <b>triplot</b> (<var>tri, x, y, linespec</var>)<var><a name="index-triplot-2783"></a></var><br> — Function File: <var>h</var> = <b>triplot</b> (<var><small class="dots">...</small></var>)<var><a name="index-triplot-2784"></a></var><br> <blockquote><p>Plot a triangular mesh in 2D. The variable <var>tri</var> is the triangular meshing of the points <code>(</code><var>x</var><code>, </code><var>y</var><code>)</code> which is returned from <code>delaunay</code>. If given, <var>linespec</var> determines the properties to use for the lines. <p>The optional return value <var>h</var> is a graphics handle to the created plot. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dplot.html#doc_002dplot">plot</a>, <a href="doc_002dtrimesh.html#doc_002dtrimesh">trimesh</a>, <a href="doc_002dtrisurf.html#doc_002dtrisurf">trisurf</a>, <a href="doc_002ddelaunay.html#doc_002ddelaunay">delaunay</a>. </p></blockquote></div> <!-- trimesh scripts/plot/trimesh.m --> <p><a name="doc_002dtrimesh"></a> <div class="defun"> — Function File: <b>trimesh</b> (<var>tri, x, y, z</var>)<var><a name="index-trimesh-2785"></a></var><br> — Function File: <var>h</var> = <b>trimesh</b> (<var><small class="dots">...</small></var>)<var><a name="index-trimesh-2786"></a></var><br> <blockquote><p>Plot a triangular mesh in 3D. The variable <var>tri</var> is the triangular meshing of the points <code>(</code><var>x</var><code>, </code><var>y</var><code>)</code> which is returned from <code>delaunay</code>. The variable <var>z</var> is value at the point <code>(</code><var>x</var><code>, </code><var>y</var><code>)</code>. <p>The optional return value <var>h</var> is a graphics handle to the created plot. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dtriplot.html#doc_002dtriplot">triplot</a>, <a href="doc_002dtrisurf.html#doc_002dtrisurf">trisurf</a>, <a href="doc_002ddelaunay3.html#doc_002ddelaunay3">delaunay3</a>. </p></blockquote></div> <!-- trisurf scripts/plot/trisurf.m --> <p><a name="doc_002dtrisurf"></a> <div class="defun"> — Function File: <b>trisurf</b> (<var>tri, x, y, z</var>)<var><a name="index-trisurf-2787"></a></var><br> — Function File: <var>h</var> = <b>trisurf</b> (<var><small class="dots">...</small></var>)<var><a name="index-trisurf-2788"></a></var><br> <blockquote><p>Plot a triangular surface in 3D. The variable <var>tri</var> is the triangular meshing of the points <code>(</code><var>x</var><code>, </code><var>y</var><code>)</code> which is returned from <code>delaunay</code>. The variable <var>z</var> is value at the point <code>(</code><var>x</var><code>, </code><var>y</var><code>)</code>. <p>The optional return value <var>h</var> is a graphics handle to the created plot. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dtriplot.html#doc_002dtriplot">triplot</a>, <a href="doc_002dtrimesh.html#doc_002dtrimesh">trimesh</a>, <a href="doc_002ddelaunay3.html#doc_002ddelaunay3">delaunay3</a>. </p></blockquote></div> <p>The difference between <code>triplot</code>, and <code>trimesh</code> or <code>triplot</code>, is that the former only plots the 2-dimensional triangulation itself, whereas the second two plot the value of a function <code>f (</code><var>x</var><code>, </code><var>y</var><code>)</code>. An example of the use of the <code>triplot</code> function is <pre class="example"> rand ("state", 2) x = rand (20, 1); y = rand (20, 1); tri = delaunay (x, y); triplot (tri, x, y); </pre> <p class="noindent">which plots the Delaunay triangulation of a set of random points in 2-dimensions. The output of the above can be seen in <a href="fig_003atriplot.html#fig_003atriplot">fig:triplot</a>. <div class="float"> <a name="fig_003atriplot"></a><div align="center"><img src="triplot.png" alt="triplot.png"></div> <p><strong class="float-caption">Figure 30.2: Delaunay triangulation of a random set of points</strong></p></div> </body></html>