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

Skip to content

Commit af43dae

Browse files
committed
TST: test that setting alpha keeps rest of color ok
1 parent c28818a commit af43dae

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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)