Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bd4b15f

Browse files
committed
BUG: preserve 'none' facecolor in Patch. Closes #7478.
1 parent 991eec1 commit bd4b15f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/matplotlib/patches.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ def set_alpha(self, alpha):
356356
except TypeError:
357357
raise TypeError('alpha must be a float or None')
358358
artist.Artist.set_alpha(self, alpha)
359-
self._set_facecolor(self._facecolor)
359+
self._set_facecolor(self._original_facecolor)
360360
self._set_edgecolor(self._original_edgecolor)
361361
# stale is already True
362362

lib/matplotlib/tests/test_patches.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,14 @@ def test_patch_alpha_override():
173173
ax.set_ylim([-1, 2])
174174

175175

176+
@cleanup(style='default')
177+
def test_patch_color_none():
178+
# Make sure the alpha kwarg does not override 'none' facecolor.
179+
# Addresses issue #7478.
180+
c = plt.Circle((0, 0), 1, facecolor='none', alpha=1)
181+
assert c.get_facecolor()[0] == 0
182+
183+
176184
@image_comparison(baseline_images=['patch_custom_linestyle'],
177185
remove_text=True)
178186
def test_patch_custom_linestyle():

0 commit comments

Comments
 (0)