Skip to content

Commit

Permalink
Make colorbar draw edge with facecolor around the faces. This was cha…
Browse files Browse the repository at this point in the history
…nged when matplotlib#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'
  • Loading branch information
jenshnielsen committed Aug 31, 2012
1 parent cf7618c commit d631dfd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
8 changes: 5 additions & 3 deletions lib/matplotlib/axes.py
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/colorbar.py
Expand Up @@ -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.
Expand Down
9 changes: 5 additions & 4 deletions lib/mpl_toolkits/axes_grid1/colorbar.py
Expand Up @@ -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...
Expand All @@ -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
Expand Down

0 comments on commit d631dfd

Please sign in to comment.