@@ -36,11 +36,12 @@ def tripcolor(ax, *args, **kwargs):
36
36
values are defined at points unless the kwarg *colorpoints* is
37
37
set to *False*.
38
38
39
- *shading* may be 'flat' (the default), 'faceted' or 'gouraud'. If
40
- *shading* is 'flat' or 'faceted' and C values are defined at
41
- points, the color values used for each triangle are from the mean
42
- C of the triangle's three points. If *shading* is 'gouraud' then
43
- color values must be defined at triangles.
39
+ *shading* may be 'flat' (the default) or 'gouraud'. If *shading*
40
+ is 'flat' and C values are defined at points, the color values
41
+ used for each triangle are from the mean C of the triangle's
42
+ three points. If *shading* is 'gouraud' then color values must be
43
+ defined at triangles. *shading* of 'faceted' is deprecated;
44
+ please use *edgecolors* instead.
44
45
45
46
The remaining kwargs are the same as for
46
47
:meth:`~matplotlib.axes.Axes.pcolor`.
@@ -62,6 +63,28 @@ def tripcolor(ax, *args, **kwargs):
62
63
tri , args , kwargs = Triangulation .get_from_args_and_kwargs (* args , ** kwargs )
63
64
C = np .asarray (args [0 ])
64
65
66
+
67
+ # Handling of linewidths, shading, edgecolors and antialiased as
68
+ # in Axes.pcolor
69
+ linewidths = (0.25 ,)
70
+ if 'linewidth' in kwargs :
71
+ kwargs ['linewidths' ] = kwargs .pop ('linewidth' )
72
+ kwargs .setdefault ('linewidths' , linewidths )
73
+
74
+ if shading == 'faceted' : # Deprecated.
75
+ edgecolors = 'k' ,
76
+ else :
77
+ edgecolors = 'none'
78
+ if 'edgecolor' in kwargs :
79
+ kwargs ['edgecolors' ] = kwargs .pop ('edgecolor' )
80
+ ec = kwargs .setdefault ('edgecolors' , edgecolors )
81
+
82
+ if 'antialiased' in kwargs :
83
+ kwargs ['antialiaseds' ] = kwargs .pop ('antialiased' )
84
+ if 'antialiaseds' not in kwargs and ec .lower () == "none" :
85
+ kwargs ['antialiaseds' ] = False
86
+
87
+
65
88
if shading == 'gouraud' :
66
89
if len (C ) != len (tri .x ):
67
90
raise ValueError ('For gouraud shading, the length of C '
@@ -79,16 +102,6 @@ def tripcolor(ax, *args, **kwargs):
79
102
if len (C ) == len (tri .x ) and len (C ) == len (tri .triangles ):
80
103
CAtPoints = colorpoints
81
104
82
- if shading == 'faceted' :
83
- edgecolors = (0 ,0 ,0 ,1 ),
84
- linewidths = (0.25 ,)
85
- else :
86
- edgecolors = 'face'
87
- linewidths = (1.0 ,)
88
- kwargs .setdefault ('edgecolors' , edgecolors )
89
- kwargs .setdefault ('antialiaseds' , (0 ,))
90
- kwargs .setdefault ('linewidths' , linewidths )
91
-
92
105
# Vertices of triangles.
93
106
maskedTris = tri .get_masked_triangles ()
94
107
verts = np .concatenate ((tri .x [maskedTris ][...,np .newaxis ],
0 commit comments