diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py index 928f52c3b8a6..fa75d7c426e5 100644 --- a/lib/matplotlib/legend.py +++ b/lib/matplotlib/legend.py @@ -367,8 +367,9 @@ def __init__(self, parent, handles, labels, # init with null renderer self._init_legend_box(handles, labels) - if framealpha is not None: - self.get_frame().set_alpha(framealpha) + if framealpha is None: + framealpha = rcParams["legend.framealpha"] + self.get_frame().set_alpha(framealpha) self._loc = loc self.set_title(title) diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index 7d4d97df1572..bfbd2431fd3e 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -632,6 +632,8 @@ def __call__(self, s): 'legend.shadow': [False, validate_bool], # whether or not to draw a frame around legend 'legend.frameon': [True, validate_bool], + # the alpha channel for the frame + 'legend.framealpha': [1.0, validate_float], ## the following dimensions are in fraction of the font size diff --git a/matplotlibrc.template b/matplotlibrc.template index 6edf352f7ae5..73fa6ebbe706 100644 --- a/matplotlibrc.template +++ b/matplotlibrc.template @@ -317,6 +317,7 @@ backend : %(backend)s #legend.shadow : False #legend.frameon : True # whether or not to draw a frame around legend #legend.scatterpoints : 3 # number of scatter points +#legend.framealpha : 1.0 # the alpha channel of the frame ### FIGURE # See http://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure