diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index 932bf594275f..1544c48d43b4 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -168,6 +168,8 @@ def update_from(self, other): # getters/setters, so we just copy them directly. self._edgecolor = other._edgecolor self._facecolor = other._facecolor + self._original_edgecolor = other._original_edgecolor + self._original_facecolor = other._original_facecolor self._fill = other._fill self._hatch = other._hatch self._hatch_color = other._hatch_color diff --git a/lib/matplotlib/tests/test_legend.py b/lib/matplotlib/tests/test_legend.py index 1562e14a34c3..4f92f044fd6b 100644 --- a/lib/matplotlib/tests/test_legend.py +++ b/lib/matplotlib/tests/test_legend.py @@ -543,3 +543,12 @@ def test_draggable(): with pytest.warns(MatplotlibDeprecationWarning): legend.draggable() assert not legend.get_draggable() + + +def test_alpha_handles(): + x, n, hh = plt.hist([1, 2, 3], alpha=0.25, label='data', color='red') + legend = plt.legend() + for lh in legend.legendHandles: + lh.set_alpha(1.0) + assert lh.get_facecolor()[:-1] == hh[1].get_facecolor()[:-1] + assert lh.get_edgecolor()[:-1] == hh[1].get_edgecolor()[:-1]