Skip to content

Commit

Permalink
MNT : remove deprecated value of kwarg in tri.tripcolor
Browse files Browse the repository at this point in the history
Deprecated in matplotlib#850 / 360887a

Also added validation on value of shading to only be in the supported
set.

attn @ianthomas23
  • Loading branch information
tacaswell committed Jan 22, 2015
1 parent f431d48 commit a78746d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions doc/api/api_changes/code_removal.rst
Expand Up @@ -41,3 +41,9 @@ Change your import from 'matplotlib.sphinxext.ipython_directive' to
LineCollection.color
--------------------
Deprecated in 2005, use ``set_color``


remove 'faceted' as a valid value for `shading` in ``tri.tripcolor``
--------------------------------------------------------------------
Use `edgecolor` instead. Added validation on ``shading`` to
only be valid values.
12 changes: 6 additions & 6 deletions lib/matplotlib/tri/tripcolor.py
Expand Up @@ -44,8 +44,7 @@ def tripcolor(ax, *args, **kwargs):
is 'flat' and C values are defined at points, the color values
used for each triangle are from the mean C of the triangle's
three points. If *shading* is 'gouraud' then color values must be
defined at points. *shading* of 'faceted' is deprecated;
please use *edgecolors* instead.
defined at points.
The remaining kwargs are the same as for
:meth:`~matplotlib.axes.Axes.pcolor`.
Expand All @@ -65,6 +64,10 @@ def tripcolor(ax, *args, **kwargs):
shading = kwargs.pop('shading', 'flat')
facecolors = kwargs.pop('facecolors', None)

if shading not in ['flat', 'gouraud']:
raise ValueError("shading must be one of ['flat', 'gouraud'] "
"not {}".format(shading))

tri, args, kwargs = Triangulation.get_from_args_and_kwargs(*args, **kwargs)

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

if shading == 'faceted': # Deprecated.
edgecolors = 'k'
else:
edgecolors = 'none'
edgecolors = 'none'
if 'edgecolor' in kwargs:
kwargs['edgecolors'] = kwargs.pop('edgecolor')
ec = kwargs.setdefault('edgecolors', edgecolors)
Expand Down

0 comments on commit a78746d

Please sign in to comment.