From c28818a887e8e4fdd9b0ec504cd3ad412c63139c Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Wed, 18 Jul 2018 19:28:16 -0700 Subject: [PATCH 1/2] FIX: make update-from also set the original face/edgecoloe --- lib/matplotlib/patches.py | 2 ++ 1 file changed, 2 insertions(+) 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 From af43dae448d5938403ef4bb699cc74e22d051ca0 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Wed, 18 Jul 2018 21:31:01 -0700 Subject: [PATCH 2/2] TST: test that setting alpha keeps rest of color ok --- lib/matplotlib/tests/test_legend.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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] pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy