Skip to content

Commit 8496e06

Browse files
committed
Merge pull request matplotlib#3369 from e-q/legendFrameAlpha
BUG : Added legend.framealpha to rcParams, as mentioned in axes.legend docstring
1 parent d10e26e commit 8496e06

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lib/matplotlib/legend.py

+3-1
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

+2-1
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

matplotlibrc.template

+1
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ backend : %(backend)s
316316
#legend.columnspacing : 2. # the border between the axes and legend edge in fraction of fontsize
317317
#legend.shadow : False
318318
#legend.frameon : True # whether or not to draw a frame around legend
319+
#legend.framealpha : 1.0 # opacity of of legend frame
319320
#legend.scatterpoints : 3 # number of scatter points
320321

321322
### FIGURE

0 commit comments

Comments
 (0)