From a78746dff3026753bb663811ef5616550a5ab3d3 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sat, 10 Jan 2015 15:55:25 -0500 Subject: [PATCH] MNT : remove deprecated value of kwarg in tri.tripcolor Deprecated in #850 / 360887ace7993c25ba23c29ac2b35e5265dfdc76 Also added validation on value of shading to only be in the supported set. attn @ianthomas23 --- doc/api/api_changes/code_removal.rst | 6 ++++++ lib/matplotlib/tri/tripcolor.py | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/api/api_changes/code_removal.rst b/doc/api/api_changes/code_removal.rst index 3e2abf0ddb9c..920fd90e28cd 100644 --- a/doc/api/api_changes/code_removal.rst +++ b/doc/api/api_changes/code_removal.rst @@ -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. diff --git a/lib/matplotlib/tri/tripcolor.py b/lib/matplotlib/tri/tripcolor.py index 7221ce2e1082..449ec03a0ed5 100644 --- a/lib/matplotlib/tri/tripcolor.py +++ b/lib/matplotlib/tri/tripcolor.py @@ -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`. @@ -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). @@ -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)