@@ -2067,8 +2067,8 @@ def contourf(self, X, Y, Z, *args, **kwargs):
20672067
20682068 contourf3D = contourf
20692069
2070- def tricontourf (self , X , Y , Z , offset = None , zdir = 'z' , * args , ** kwargs ):
2071- '''
2070+ def tricontourf (self , * args , ** kwargs ):
2071+ """
20722072 Create a 3D contourf plot.
20732073
20742074 ========== ================================================
@@ -2086,15 +2086,27 @@ def tricontourf(self, X, Y, Z, offset=None, zdir='z', *args, **kwargs):
20862086
20872087 Returns a :class:`~matplotlib.axes.Axes.contour`
20882088
2089- .. versionadded :: 1.1.0
2090- '''
2089+ .. versionchanged :: 1.3.0
2090+ Added support for custom triangulations
2091+ """
20912092 zdir = kwargs .pop ('zdir' , 'z' )
20922093 offset = kwargs .pop ('offset' , None )
20932094
20942095 had_data = self .has_data ()
20952096
2097+ tri , args , kwargs = Triangulation .get_from_args_and_kwargs (
2098+ * args , ** kwargs )
2099+ X = tri .x
2100+ Y = tri .y
2101+ Z = args [0 ]
2102+
2103+ # We do this so Z doesn't get passed as an arg to Axes.tricontour
2104+ args = args [1 :]
2105+
20962106 jX , jY , jZ = art3d .rotate_axes (X , Y , Z , zdir )
2097- cset = Axes .tricontourf (self , X , Y , Z , * args , ** kwargs )
2107+ tri = Triangulation (jX , jY , tri .triangles , tri .mask )
2108+
2109+ cset = Axes .tricontourf (self , tri , jZ , * args , ** kwargs )
20982110 self .add_contourf_set (cset , zdir , offset )
20992111
21002112 self .auto_scale_xyz (X , Y , Z , had_data )
0 commit comments