Skip to content

Commit a78746d

Browse files
committed
MNT : remove deprecated value of kwarg in tri.tripcolor
Deprecated in matplotlib#850 / 360887a Also added validation on value of shading to only be in the supported set. attn @ianthomas23
1 parent f431d48 commit a78746d

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

doc/api/api_changes/code_removal.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,9 @@ Change your import from 'matplotlib.sphinxext.ipython_directive' to
4141
LineCollection.color
4242
--------------------
4343
Deprecated in 2005, use ``set_color``
44+
45+
46+
remove 'faceted' as a valid value for `shading` in ``tri.tripcolor``
47+
--------------------------------------------------------------------
48+
Use `edgecolor` instead. Added validation on ``shading`` to
49+
only be valid values.

lib/matplotlib/tri/tripcolor.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ def tripcolor(ax, *args, **kwargs):
4444
is 'flat' and C values are defined at points, the color values
4545
used for each triangle are from the mean C of the triangle's
4646
three points. If *shading* is 'gouraud' then color values must be
47-
defined at points. *shading* of 'faceted' is deprecated;
48-
please use *edgecolors* instead.
47+
defined at points.
4948
5049
The remaining kwargs are the same as for
5150
:meth:`~matplotlib.axes.Axes.pcolor`.
@@ -65,6 +64,10 @@ def tripcolor(ax, *args, **kwargs):
6564
shading = kwargs.pop('shading', 'flat')
6665
facecolors = kwargs.pop('facecolors', None)
6766

67+
if shading not in ['flat', 'gouraud']:
68+
raise ValueError("shading must be one of ['flat', 'gouraud'] "
69+
"not {}".format(shading))
70+
6871
tri, args, kwargs = Triangulation.get_from_args_and_kwargs(*args, **kwargs)
6972

7073
# C is the colors array defined at either points or faces (i.e. triangles).
@@ -97,10 +100,7 @@ def tripcolor(ax, *args, **kwargs):
97100
kwargs['linewidths'] = kwargs.pop('linewidth')
98101
kwargs.setdefault('linewidths', linewidths)
99102

100-
if shading == 'faceted': # Deprecated.
101-
edgecolors = 'k'
102-
else:
103-
edgecolors = 'none'
103+
edgecolors = 'none'
104104
if 'edgecolor' in kwargs:
105105
kwargs['edgecolors'] = kwargs.pop('edgecolor')
106106
ec = kwargs.setdefault('edgecolors', edgecolors)

0 commit comments

Comments
 (0)