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

Skip to content

Commit a030a8d

Browse files
committed
alpha of legend is now set with set_alpha method and thus changed
the test to use the get_alpha method
1 parent 538da87 commit a030a8d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/matplotlib/legend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,8 @@ def __init__(self, parent, handles, labels,
387387
# If shadow is activated use framealpha if not
388388
# explicitly passed. See Issue 8943
389389
if framealpha is None:
390-
if shadow is True:
391-
self.framealpha = 1
390+
if shadow:
391+
self.get_frame().set_alpha(1)
392392
else:
393393
self.get_frame().set_alpha(rcParams["legend.framealpha"])
394394
else:

lib/matplotlib/tests/test_legend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,4 +367,4 @@ def test_shadow_framealpha():
367367
fig, ax = plt.subplots()
368368
ax.plot(range(100), label="test")
369369
leg = ax.legend(shadow=True, facecolor='w')
370-
assert leg.framealpha == 1
370+
assert leg.get_frame().get_alpha() == 1

0 commit comments

Comments
 (0)