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

Skip to content

Commit 01c2de0

Browse files
committed
add "legend.frameon" to rcParams
modified: lib/matplotlib/axes.py modified: lib/matplotlib/legend.py modified: lib/matplotlib/rcsetup.py modified: matplotlibrc.template
1 parent 018d533 commit 01c2de0

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

lib/matplotlib/axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4356,7 +4356,7 @@ def legend(self, *args, **kwargs):
43564356
settings.
43574357
43584358
*frameon*: [ True | False ]
4359-
if True, draw a frame. Default is True
4359+
if True, draw a frame around the legend.
43604360
43614361
*fancybox*: [ None | False | True ]
43624362
if True, draw a frame with a round fancybox. If None, use rc

lib/matplotlib/legend.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def __init__(self, parent, handles, labels,
158158
title = None, # set a title for the legend
159159
bbox_to_anchor = None, # bbox that the legend will be anchored.
160160
bbox_transform = None, # transform for the bbox
161-
frameon = True, # draw frame
161+
frameon = None, # draw frame
162162
handler_map = None,
163163
):
164164
"""
@@ -177,7 +177,7 @@ def __init__(self, parent, handles, labels,
177177
numpoints the number of points in the legend for line
178178
scatterpoints the number of points in the legend for scatter plot
179179
scatteryoffsets a list of yoffsets for scatter symbols in legend
180-
frameon if True, draw a frame (default is True)
180+
frameon if True, draw a frame around the legend
181181
fancybox if True, draw a frame with a round fancybox. If None, use rc
182182
shadow if True, draw a shadow behind legend
183183
ncol number of columns
@@ -355,7 +355,8 @@ def __init__(self, parent, handles, labels,
355355

356356
self._set_artist_props(self.legendPatch)
357357

358-
self._drawFrame = frameon
358+
if frameon is None:
359+
self._drawFrame = rcParams["legend.frameon"]
359360

360361
# init with null renderer
361362
self._init_legend_box(handles, labels)

lib/matplotlib/rcsetup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ def __call__(self, s):
462462
'legend.fontsize' : ['large', validate_fontsize],
463463
'legend.markerscale' : [1.0, validate_float], # the relative size of legend markers vs. original
464464
'legend.shadow' : [False, validate_bool],
465+
'legend.frameon' : [True, validate_bool], # whether or not to draw a frame around legend
465466

466467

467468
# the following dimensions are in fraction of the font size

matplotlibrc.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ backend : %(backend)s
249249
#legend.handletextsep : 0.02 # the space between the legend line and legend text
250250
#legend.axespad : 0.02 # the border between the axes and legend edge
251251
#legend.shadow : False
252+
#legend.frameon : True # whether or not to draw a frame around legend
252253

253254
### FIGURE
254255
# See http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure

0 commit comments

Comments
 (0)