8000 Fixes bug where if alpha is set and edgecolor='none', edges would sti… · matplotlib/matplotlib@461233c · GitHub
[go: up one dir, main page]

Skip to content

Commit 461233c

Browse files
committed
Fixes bug where if alpha is set and edgecolor='none', edges would still be rendered as black.
1 parent 2f3f7e6 commit 461233c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/matplotlib/patches.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ def set_edgecolor(self, color):
251251
"""
252252
if color is None:
253253
color = mpl.rcParams['patch.edgecolor']
254+
self._original_edgecolor = color
254255
self._edgecolor = colors.colorConverter.to_rgba(color, self._alpha)
255256

256257
def set_ec(self, color):
@@ -304,8 +305,7 @@ def set_alpha(self, alpha):
304305
artist.Artist.set_alpha(self, alpha)
305306
self.set_facecolor(self._original_facecolor) # using self._fill and
306307
# self._alpha
307-
self._edgecolor = colors.colorConverter.to_rgba(
308-
self._edgecolor[:3], self._alpha)
308+
self.set_edgecolor(self._original_edgecolor)
309309

310310
def set_linewidth(self, w):
311311
"""
@@ -421,9 +421,10 @@ def draw(self, renderer):
421421
if rgbFace[3] == 0:
422422
rgbFace = None # (some?) renderers expect this as no-fill signal
423423

424-
gc.set_alpha(self._edgecolor[3])
425424
if self._edgecolor[3] == 0:
426425
gc.set_alpha(self._facecolor[3])
426+
else:
427+
gc.set_alpha(self._edgecolor[3])
427428

428429
if self._hatch:
429430
gc.set_hatch(self._hatch)

0 commit comments

Comments
 (0)
0