Skip to content

Commit d631dfd

Browse files
committed
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'
1 parent cf7618c commit d631dfd

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

lib/matplotlib/axes.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7360,10 +7360,12 @@ def pcolormesh(self, *args, **kwargs):
73607360
'gouraud', each quad will be Gouraud shaded. When gouraud
73617361
shading, edgecolors is ignored.
73627362
7363-
*edgecolors*: [ *None* | ``'None'`` | color | color sequence]
7363+
*edgecolors*: [ *None* | ``'None'`` | ``'face'`` | color | color sequence]
73647364
If *None*, the rc setting is used by default.
73657365
7366-
If ``'None'``, edges will not be visible.
7366+
If ``'None'``, edges will not be visible.
7367+
7368+
If ``'face'``, edges will have the same color as the faces.
73677369
73687370
An mpl color or sequence of colors will set the edge color
73697371
@@ -7393,7 +7395,7 @@ def pcolormesh(self, *args, **kwargs):
73937395
vmax = kwargs.pop('vmax', None)
73947396
shading = kwargs.pop('shading', 'flat').lower()
73957397
antialiased = kwargs.pop('antialiased', False)
7396-
kwargs.setdefault('edgecolors', 'None')
7398+
kwargs.setdefault('edgecolors', 'face')
73977399

73987400
X, Y, C = self._pcolorargs('pcolormesh', *args)
73997401
Ny, Nx = X.shape

lib/matplotlib/colorbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ def _add_solids(self, X, Y, C):
445445
kw = dict(cmap=self.cmap,
446446
norm=self.norm,
447447
alpha=self.alpha,
448-
edgecolors='None')
448+
edgecolors='face')
449449
# Save, set, and restore hold state to keep pcolor from
450450
# clearing the axes. Ordinarily this will not be needed,
451451
# since the axes object should already have hold set.

lib/mpl_toolkits/axes_grid1/colorbar.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ def _edges(self, X, Y):
518518

519519
def _add_solids(self, X, Y, C):
520520
'''
521-
Draw the colors using :meth:`~matplotlib.axes.Axes.pcolor`;
521+
Draw the colors using :meth:`~matplotlib.axes.Axes.pcolormesh`;
522522
optionally add separators.
523523
'''
524524
## Change to pcolorfast after fixing bugs in some backends...
@@ -537,9 +537,10 @@ def _add_solids(self, X, Y, C):
537537
args = (X, Y, C)
538538
else:
539539
args = (np.transpose(Y), np.transpose(X), np.transpose(C))
540-
kw = {'cmap':self.cmap, 'norm':self.norm,
541-
'shading':'flat', 'alpha':self.alpha,
542-
}
540+
kw = dict(cmap=self.cmap,
541+
norm=self.norm,
542+
alpha=self.alpha,
543+
edgecolors='face')
543544

544545
del self.solids
545546
del self.dividers

0 commit comments

Comments
 (0)