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

Skip to content

Commit 853c26a

Browse files
committed
Added legend.framealpha to rcParams, as alluded to by axes.legend docstring
1 parent 17adaa2 commit 853c26a

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

lib/matplotlib/legend.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,9 @@ def __init__(self, parent, handles, labels,
367367
# init with null renderer
368368
self._init_legend_box(handles, labels)
369369

370-
if framealpha is not None:
370+
if framealpha is None:
371+
self.get_frame().set_alpha(rcParams["legend.framealpha"])
372+
else:
371373
self.get_frame().set_alpha(framealpha)
372374

373375
self._loc = loc

lib/matplotlib/rcsetup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,8 @@ def __call__(self, s):
632632
'legend.shadow': [False, validate_bool],
633633
# whether or not to draw a frame around legend
634634
'legend.frameon': [True, validate_bool],
635-
635+
# alpha value of the legend frame
636+
'legend.framealpha': [1.0, validate_float],
636637

637638
## the following dimensions are in fraction of the font size
638639
'legend.borderpad': [0.4, validate_float], # units are fontsize

0 commit comments

Comments
 (0)