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

Skip to content

Added legend.framealpha to rcParams, as mentioned in axes.legend docstring #3369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 18, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/users/whats_new/rcparams.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Added "legend.framealpha" key to rcParams
```````````````````````````

Added a key and the corresponding logic to control the default transparency of
legend frames. This feature was written into the docstring of axes.legend(),
but not yet implemented.
4 changes: 3 additions & 1 deletion lib/matplotlib/legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,9 @@ def __init__(self, parent, handles, labels,
# init with null renderer
self._init_legend_box(handles, labels)

if framealpha is not None:
if framealpha is None:
self.get_frame().set_alpha(rcParams["legend.framealpha"])
else:
self.get_frame().set_alpha(framealpha)

self._loc = loc
Expand Down
3 changes: 2 additions & 1 deletion lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +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],

# alpha value of the legend frame
'legend.framealpha': [1.0, validate_float],

## the following dimensions are in fraction of the font size
'legend.borderpad': [0.4, validate_float], # units are fontsize
Expand Down
1 change: 1 addition & 0 deletions matplotlibrc.template
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ backend : %(backend)s
#legend.columnspacing : 2. # the border between the axes and legend edge in fraction of fontsize
#legend.shadow : False
#legend.frameon : True # whether or not to draw a frame around legend
#legend.framealpha : 1.0 # opacity of of legend frame
#legend.scatterpoints : 3 # number of scatter points

### FIGURE
Expand Down