Skip to content

Commit 5f67813

Browse files
committed
Colorbar Add kw arguement to colorbar to reenable edges around faces in
the colorbar. Resolve problems with white lines in colorbars. Not enabled by default. See matplotlib#1178 and matplotlib#1188
1 parent a881fd9 commit 5f67813

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

‎lib/matplotlib/colorbar.py‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,13 @@
9797
:class:`~matplotlib.ticker.Formatter` object may be
9898
given instead.
9999
*drawedges* [ False | True ] If true, draw lines at color
100-
boundaries.
100+
boundaries
101+
*drawfcedges* [ False | True ] If true, draw face-colored edges around
102+
color segments. This helps with viewers that render
103+
white lines between faces in the colorbar, however it
104+
has negative consequences when ploting with alpha < 1
105+
or colorbar extensions and is thus not enabled by default.
106+
See github issue #1178 and #1188.
101107
============ ====================================================
102108
103109
The following will probably be useful only in the context of
@@ -243,6 +249,7 @@ def __init__(self, ax, cmap=None,
243249
ticks=None,
244250
format=None,
245251
drawedges=False,
252+
drawfcedges=False,
246253
filled=True,
247254
extendfrac=None,
248255
):
@@ -259,6 +266,7 @@ def __init__(self, ax, cmap=None,
259266
self.spacing = spacing
260267
self.orientation = orientation
261268
self.drawedges = drawedges
269+
self.drawfcedges = drawfcedges
262270
self.filled = filled
263271
self.extendfrac = extendfrac
264272
self.solids = None
@@ -447,10 +455,14 @@ def _add_solids(self, X, Y, C):
447455
args = (X, Y, C)
448456
else:
449457
args = (np.transpose(Y), np.transpose(X), np.transpose(C))
458+
if self.drawfcedges == True:
459+
edgecolors = 'face'
460+
else:
461+
edgecolors = 'None'
450462
kw = dict(cmap=self.cmap,
451463
norm=self.norm,
452464
alpha=self.alpha,
453-
edgecolors='None')
465+
edgecolors=edgecolors)
454466
# Save, set, and restore hold state to keep pcolor from
455467
# clearing the axes. Ordinarily this will not be needed,
456468
# since the axes object should already have hold set.

0 commit comments

Comments
 (0)