Skip to content

Commit

Permalink
Colorbar Add kw arguement to colorbar to reenable edges around faces in
Browse files Browse the repository at this point in the history
the colorbar. Resolve problems with white lines in colorbars.
Not enabled by default.  See matplotlib#1178 and matplotlib#1188
  • Loading branch information
jenshnielsen committed Sep 23, 2012
1 parent a881fd9 commit 5f67813
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/matplotlib/colorbar.py
Expand Up @@ -97,7 +97,13 @@
:class:`~matplotlib.ticker.Formatter` object may be
given instead.
*drawedges* [ False | True ] If true, draw lines at color
boundaries.
boundaries
*drawfcedges* [ False | True ] If true, draw face-colored edges around
color segments. This helps with viewers that render
white lines between faces in the colorbar, however it
has negative consequences when ploting with alpha < 1
or colorbar extensions and is thus not enabled by default.
See github issue #1178 and #1188.
============ ====================================================
The following will probably be useful only in the context of
Expand Down Expand Up @@ -243,6 +249,7 @@ def __init__(self, ax, cmap=None,
ticks=None,
format=None,
drawedges=False,
drawfcedges=False,
filled=True,
extendfrac=None,
):
Expand All @@ -259,6 +266,7 @@ def __init__(self, ax, cmap=None,
self.spacing = spacing
self.orientation = orientation
self.drawedges = drawedges
self.drawfcedges = drawfcedges
self.filled = filled
self.extendfrac = extendfrac
self.solids = None
Expand Down Expand Up @@ -447,10 +455,14 @@ def _add_solids(self, X, Y, C):
args = (X, Y, C)
else:
args = (np.transpose(Y), np.transpose(X), np.transpose(C))
if self.drawfcedges == True:
edgecolors = 'face'
else:
edgecolors = 'None'
kw = dict(cmap=self.cmap,
norm=self.norm,
alpha=self.alpha,
edgecolors='None')
edgecolors=edgecolors)
# 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

0 comments on commit 5f67813

Please sign in to comment.