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

Skip to content

Commit c552bdc

Browse files
authored
Merge pull request #11703 from jklymak/fix-update-from-patches
FIX: make update-from also set the original face/edgecolor
2 parents 068ddb3 + af43dae commit c552bdc

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/matplotlib/patches.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ def update_from(self, other):
168168
# getters/setters, so we just copy them directly.
169169
self._edgecolor = other._edgecolor
170170
self._facecolor = other._facecolor
171+
self._original_edgecolor = other._original_edgecolor
172+
self._original_facecolor = other._original_facecolor
171173
self._fill = other._fill
172174
self._hatch = other._hatch
173175
self._hatch_color = other._hatch_color

lib/matplotlib/tests/test_legend.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,3 +543,12 @@ def test_draggable():
543543
with pytest.warns(MatplotlibDeprecationWarning):
544544
legend.draggable()
545545
assert not legend.get_draggable()
546+
547+
548+
def test_alpha_handles():
549+
x, n, hh = plt.hist([1, 2, 3], alpha=0.25, label='data', color='red')
550+
legend = plt.legend()
551+
for lh in legend.legendHandles:
552+
lh.set_alpha(1.0)
553+
assert lh.get_facecolor()[:-1] == hh[1].get_facecolor()[:-1]
554+
assert lh.get_edgecolor()[:-1] == hh[1].get_edgecolor()[:-1]

0 commit comments

Comments
 (0)