From d631dfd3bf078b58e1fa313fc05159aa47f1b592 Mon Sep 17 00:00:00 2001 From: "Jens H. Nielsen" Date: Fri, 31 Aug 2012 09:11:19 +0200 Subject: [PATCH] Make colorbar draw edge with facecolor around the faces. This was changed when #901 and was merged, to allow different edgecolors, due to the way get_edgecolors behave. This restors the original behavior of colorbar in both mpl and the axisgrid1 toolkit by setting the edgecolor to 'face' --- lib/matplotlib/axes.py | 8 +++++--- lib/matplotlib/colorbar.py | 2 +- lib/mpl_toolkits/axes_grid1/colorbar.py | 9 +++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/matplotlib/axes.py b/lib/matplotlib/axes.py index 71bf4ca86a11..f583a2124889 100644 --- a/lib/matplotlib/axes.py +++ b/lib/matplotlib/axes.py @@ -7360,10 +7360,12 @@ def pcolormesh(self, *args, **kwargs): 'gouraud', each quad will be Gouraud shaded. When gouraud shading, edgecolors is ignored. - *edgecolors*: [ *None* | ``'None'`` | color | color sequence] + *edgecolors*: [ *None* | ``'None'`` | ``'face'`` | color | color sequence] If *None*, the rc setting is used by default. - If ``'None'``, edges will not be visible. + If ``'None'``, edges will not be visible. + + If ``'face'``, edges will have the same color as the faces. An mpl color or sequence of colors will set the edge color @@ -7393,7 +7395,7 @@ def pcolormesh(self, *args, **kwargs): vmax = kwargs.pop('vmax', None) shading = kwargs.pop('shading', 'flat').lower() antialiased = kwargs.pop('antialiased', False) - kwargs.setdefault('edgecolors', 'None') + kwargs.setdefault('edgecolors', 'face') X, Y, C = self._pcolorargs('pcolormesh', *args) Ny, Nx = X.shape diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index e600828d9712..f408f8c64b00 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -445,7 +445,7 @@ def _add_solids(self, X, Y, C): kw = dict(cmap=self.cmap, norm=self.norm, alpha=self.alpha, - edgecolors='None') + edgecolors='face') # Save, set, and restore hold state to keep pcolor from # clearing the axes. Ordinarily this will not be needed, # since the axes object should already have hold set. diff --git a/lib/mpl_toolkits/axes_grid1/colorbar.py b/lib/mpl_toolkits/axes_grid1/colorbar.py index b60d6a9a9398..4704da848cdf 100644 --- a/lib/mpl_toolkits/axes_grid1/colorbar.py +++ b/lib/mpl_toolkits/axes_grid1/colorbar.py @@ -518,7 +518,7 @@ def _edges(self, X, Y): def _add_solids(self, X, Y, C): ''' - Draw the colors using :meth:`~matplotlib.axes.Axes.pcolor`; + Draw the colors using :meth:`~matplotlib.axes.Axes.pcolormesh`; optionally add separators. ''' ## Change to pcolorfast after fixing bugs in some backends... @@ -537,9 +537,10 @@ def _add_solids(self, X, Y, C): args = (X, Y, C) else: args = (np.transpose(Y), np.transpose(X), np.transpose(C)) - kw = {'cmap':self.cmap, 'norm':self.norm, - 'shading':'flat', 'alpha':self.alpha, - } + kw = dict(cmap=self.cmap, + norm=self.norm, + alpha=self.alpha, + edgecolors='face') del self.solids del self.dividers