From 11fd0ee35b40cfea4f1086d3aea36f78a9b7e1c4 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Wed, 3 Sep 2014 13:49:39 +0200 Subject: [PATCH] Add legend.framealpha to matplotlibrc So far it is only referenced in lib/matplotlib/axes/_axes.py:legend() and this commit finally adds it to matplotlibrc. --- lib/matplotlib/legend.py | 5 +++-- lib/matplotlib/rcsetup.py | 2 ++ matplotlibrc.template | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) 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