@@ -1562,7 +1562,7 @@ def plot_wireframe(self, X, Y, Z, *args, **kwargs):
15621562
15631563 return linec
15641564
1565- def plot_trisurf (self , X , Y , Z , * args , ** kwargs ):
1565+ def plot_trisurf (self , * args , ** kwargs ):
15661566 """
15671567 ============= ================================================
15681568 Argument Description
@@ -1576,9 +1576,37 @@ def plot_trisurf(self, X, Y, Z, *args, **kwargs):
15761576 *shade* Whether to shade the facecolors
15771577 ============= ================================================
15781578
1579+ The (optional) triangulation can be specified in one of two ways;
1580+ either::
1581+
1582+ plot_trisurf(triangulation, ...)
1583+
1584+ where triangulation is a :class:`~matplotlib.tri.Triangulation`
1585+ object, or::
1586+
1587+ plot_trisurf(X, Y, ...)
1588+ plot_trisurf(X, Y, triangles, ...)
1589+ plot_trisurf(X, Y, triangles=triangles, ...)
1590+
1591+ in which case a Triangulation object will be created. See
1592+ :class:`~matplotlib.tri.Triangulation` for a explanation of
1593+ these possibilities.
1594+
1595+ The remaining arguments are::
1596+
1597+ plot_trisurf(..., Z)
1598+
1599+ where *Z* is the array of values to contour, one per point
1600+ in the triangulation.
1601+
15791602 Other arguments are passed on to
15801603 :class:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection`
15811604
1605+ **Examples:**
1606+
1607+ .. plot:: mpl_examples/mplot3d/trisurf3d_demo.py
1608+ .. plot:: mpl_examples/mplot3d/trisurf3d_demo2.py
1609+
15821610 .. versionadded:: 1.2.0
15831611 This plotting function was added for the v1.2.0 release.
15841612 """
@@ -1596,15 +1624,13 @@ def plot_trisurf(self, X, Y, Z, *args, **kwargs):
15961624 shade = kwargs .pop ('shade' , cmap is None )
15971625 lightsource = kwargs .pop ('lightsource' , None )
15981626
1599- # TODO: Support masked triangulations
1600- tri = Triangulation (X , Y )
1601- x = tri .x
1602- y = tri .y
1603- triangles = tri .triangles
1627+ tri , args , kwargs = Triangulation .get_from_args_and_kwargs (* args , ** kwargs )
1628+ z = np .asarray (args [0 ])
16041629
1605- xt = x [triangles ][...,np .newaxis ]
1606- yt = y [triangles ][...,np .newaxis ]
1607- zt = np .array (Z )[triangles ][...,np .newaxis ]
1630+ triangles = tri .get_masked_triangles ()
1631+ xt = tri .x [triangles ][...,np .newaxis ]
1632+ yt = tri .y [triangles ][...,np .newaxis ]
1633+ zt = np .array (z )[triangles ][...,np .newaxis ]
16081634
16091635 verts = np .concatenate ((xt , yt , zt ), axis = 2 )
16101636
@@ -1649,7 +1675,7 @@ def plot_trisurf(self, X, Y, Z, *args, **kwargs):
16491675 polyc .set_facecolors (colset )
16501676
16511677 self .add_collection (polyc )
1652- self .auto_scale_xyz (X , Y , Z , had_data )
1678+ self .auto_scale_xyz (tri . x , tri . y , z , had_data )
16531679
16541680 return polyc
16551681
0 commit comments