← 输入框|github.com|刷新
Skip to content
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
3 changes: 2 additions & 1 deletion lib/matplotlib/axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4356,7 +4356,8 @@ def legend(self, *args, **kwargs):
settings.

*frameon*: [ True | False ]
if True, draw a frame. Default is True
if True, draw a frame around the legend.
The default is set by the rcParam 'legend.frameon'

*fancybox*: [ None | False | True ]
if True, draw a frame with a round fancybox. If None, use rc
Expand Down
6 changes: 4 additions & 2 deletions lib/matplotlib/legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def __init__(self, parent, handles, labels,
title = None, # set a title for the legend
bbox_to_anchor = None, # bbox that the legend will be anchored.
bbox_transform = None, # transform for the bbox
frameon = True, # draw frame
frameon = None, # draw frame
handler_map = None,
):
"""
Expand All @@ -177,7 +177,7 @@ def __init__(self, parent, handles, labels,
numpoints the number of points in the legend for line
scatterpoints the number of points in the legend for scatter plot
scatteryoffsets a list of yoffsets for scatter symbols in legend
frameon if True, draw a frame (default is True)
frameon if True, draw a frame around the legend. If None, use rc
fancybox if True, draw a frame with a round fancybox. If None, use rc
shadow if True, draw a shadow behind legend
ncol number of columns
Expand Down Expand Up @@ -356,6 +356,8 @@ def __init__(self, parent, handles, labels,
self._set_artist_props(self.legendPatch)

self._drawFrame = frameon
if frameon is None:
self._drawFrame = rcParams["legend.frameon"]

# init with null renderer
self._init_legend_box(handles, labels)
Expand Down
1 change: 1 addition & 0 deletions lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ def __call__(self, s):
'legend.fontsize' : ['large', validate_fontsize],
'legend.markerscale' : [1.0, validate_float], # the relative size of legend markers vs. original
'legend.shadow' : [False, validate_bool],
'legend.frameon' : [True, validate_bool], # whether or not to draw a frame around legend


# the following dimensions are in fraction of the font size
Expand Down
1 change: 1 addition & 0 deletions matplotlibrc.template
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ backend : %(backend)s
#legend.handletextsep : 0.02 # the space between the legend line and legend text
#legend.axespad : 0.02 # the border between the axes and legend edge
#legend.shadow : False
#legend.frameon : True # whether or not to draw a frame around legend

### FIGURE
# See http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure
Expand Down