Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 80a3f3e

Browse filesBrowse files
committed
Merge remote-tracking branch 'matplotlib/v2.x'
2 parents 0fadaaf + 18ffa3e commit 80a3f3e
Copy full SHA for 80a3f3e

File tree

Expand file treeCollapse file tree

10 files changed

+76
-27
lines changed
Filter options
Expand file treeCollapse file tree

10 files changed

+76
-27
lines changed

‎.travis.yml

Copy file name to clipboardExpand all lines: .travis.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ script:
147147
fi
148148
else
149149
cd doc
150-
python make.py html --small
150+
python make.py html
151151
# We don't build the LaTeX docs here, so linkchecker will complain
152152
touch build/html/Matplotlib.pdf
153153
# Linkchecker only works with python 2.7 for the time being

‎doc/api/api_changes/2016-07-20-EF.rst

Copy file name to clipboard
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
`Legend` initializers gain edgecolor and facecolor kwargs
2+
``````````````````````````````````````````````````````````
3+
4+
The :class:`~matplotlib.legend.Legend` background patch (or 'frame')
5+
can have its `edgecolor` and `facecolor` determined by the
6+
corresponding keyword arguments to its initializer, or to any of the
7+
methods or functions that call that initializer. If left to
8+
their default values of `None`, their values will be taken from
9+
`rcParams`. The previously-existing `framealpha` kwarg still
10+
controls the alpha transparency of the patch.

‎doc/conf.py

Copy file name to clipboardExpand all lines: doc/conf.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
# Plot directive configuration
116116
# ----------------------------
117117

118-
plot_formats = [('svg', 72), ('png', 80)]
118+
plot_formats = [('svg', 72), ('png', 100)]
119119

120120
# Subdirectories in 'examples/' directory of package and titles for gallery
121121
mpl_example_sections = [

‎doc/make.py

Copy file name to clipboardExpand all lines: doc/make.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def html(buildername='html'):
4747
copy_if_out_of_date(rc, '_static/matplotlibrc')
4848

4949
if small_docs:
50-
options = "-D plot_formats=png:80"
50+
options = "-D plot_formats=png:100"
5151
else:
5252
options = ''
5353
if warnings_as_errors:

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+16-2Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ def legend(self, *args, **kwargs):
410410
label
411411
412412
frameon : None or bool
413-
Control whether a frame should be drawn around the legend.
413+
Control whether the legend should be drawn on a patch (frame).
414414
Default is ``None`` which will take the value from the
415415
``legend.frameon`` :data:`rcParam<matplotlib.rcParams>`.
416416
@@ -427,10 +427,24 @@ def legend(self, *args, **kwargs):
427427
``legend.shadow`` :data:`rcParam<matplotlib.rcParams>`.
428428
429429
framealpha : None or float
430-
Control the alpha transparency of the legend's frame.
430+
Control the alpha transparency of the legend's background.
431431
Default is ``None`` which will take the value from the
432432
``legend.framealpha`` :data:`rcParam<matplotlib.rcParams>`.
433433
434+
facecolor : None or "inherit" or a color spec
435+
Control the legend's background color.
436+
Default is ``None`` which will take the value from the
437+
``legend.facecolor`` :data:`rcParam<matplotlib.rcParams>`.
438+
If ``"inherit"``, it will take the ``axes.facecolor``
439+
:data:`rcParam<matplotlib.rcParams>`.
440+
441+
edgecolor : None or "inherit" or a color spec
442+
Control the legend's background patch edge color.
443+
Default is ``None`` which will take the value from the
444+
``legend.edgecolor`` :data:`rcParam<matplotlib.rcParams>`.
445+
If ``"inherit"``, it will take the ``axes.edgecolor``
446+
:data:`rcParam<matplotlib.rcParams>`.
447+
434448
mode : {"expand", None}
435449
If `mode` is set to ``"expand"`` the legend will be horizontally
436450
expanded to fill the axes area (or `bbox_to_anchor` if defines

‎lib/matplotlib/contour.py

Copy file name to clipboardExpand all lines: lib/matplotlib/contour.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ def _autolev(self, N):
11481148
if self.logscale:
11491149
self.locator = ticker.LogLocator()
11501150
else:
1151-
self.locator = ticker.MaxNLocator(N + 1)
1151+
self.locator = ticker.MaxNLocator(N + 1, min_n_ticks=1)
11521152
zmax = self.zmax
11531153
zmin = self.zmin
11541154
lev = self.locator.tick_values(zmin, zmax)

‎lib/matplotlib/figure.py

Copy file name to clipboardExpand all lines: lib/matplotlib/figure.py
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,12 +1339,36 @@ def legend(self, handles, labels, *args, **kwargs):
13391339
if *False*, legend marker is placed to the right of the legend
13401340
label
13411341
1342+
*frameon*: [ *None* | bool ]
1343+
Control whether the legend should be drawn on a patch (frame).
1344+
Default is *None* which will take the value from the
1345+
``legend.frameon`` :data:`rcParam<matplotlib.rcParams>`.
1346+
13421347
*fancybox*: [ *None* | *False* | *True* ]
13431348
if *True*, draw a frame with a round fancybox. If *None*, use rc
13441349
13451350
*shadow*: [ *None* | *False* | *True* ]
13461351
If *True*, draw a shadow behind legend. If *None*, use rc settings.
13471352
1353+
*framealpha*: [ *None* | float ]
1354+
Control the alpha transparency of the legend's background.
1355+
Default is *None* which will take the value from the
1356+
``legend.framealpha`` :data:`rcParam<matplotlib.rcParams>`.
1357+
1358+
*facecolor*: [ *None* | "inherit" | a color spec ]
1359+
Control the legend's background color.
1360+
Default is *None* which will take the value from the
1361+
``legend.facecolor`` :data:`rcParam<matplotlib.rcParams>`.
1362+
If ``"inherit"``, it will take the ``axes.facecolor``
1363+
:data:`rcParam<matplotlib.rcParams>`.
1364+
1365+
*edgecolor*: [ *None* | "inherit" | a color spec ]
1366+
Control the legend's background patch edge color.
1367+
Default is *None* which will take the value from the
1368+
``legend.edgecolor`` :data:`rcParam<matplotlib.rcParams>`.
1369+
If ``"inherit"``, it will take the ``axes.edgecolor``
1370+
:data:`rcParam<matplotlib.rcParams>`.
1371+
13481372
*ncol* : integer
13491373
number of columns. default is 1
13501374

‎lib/matplotlib/legend.py

Copy file name to clipboardExpand all lines: lib/matplotlib/legend.py
+16-15Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ def __init__(self, parent, handles, labels,
181181
title=None, # set a title for the legend
182182

183183
framealpha=None, # set frame alpha
184+
edgecolor=None, # frame patch edgecolor
185+
facecolor=None, # frame patch facecolor
184186

185187
bbox_to_anchor=None, # bbox that the legend will be anchored.
186188
bbox_transform=None, # transform for the bbox
@@ -198,21 +200,20 @@ def __init__(self, parent, handles, labels,
198200
================ ====================================================
199201
Keyword Description
200202
================ ====================================================
201-
loc a location code
203+
loc Location code string, or tuple (see below).
202204
prop the font property
203205
fontsize the font size (used only if prop is not specified)
204206
markerscale the relative size of legend markers vs. original
205-
markerfirst If true, place legend marker to left of label
206-
If false, place legend marker to right of label
207+
markerfirst If True (default), marker is to left of the label.
207208
numpoints the number of points in the legend for line
208209
scatterpoints the number of points in the legend for scatter plot
209210
scatteryoffsets a list of yoffsets for scatter symbols in legend
210-
frameon if True, draw a frame around the legend.
211-
If None, use rc
212-
fancybox if True, draw a frame with a round fancybox.
213-
If None, use rc
214-
shadow if True, draw a shadow behind legend
215-
framealpha If not None, alpha channel for the frame.
211+
frameon If True, draw the legend on a patch (frame).
212+
fancybox If True, draw the frame with a round fancybox.
213+
shadow If True, draw a shadow behind legend.
214+
framealpha Transparency of the frame.
215+
edgecolor Frame edgecolor.
216+
facecolor Frame facecolor.
216217
ncol number of columns
217218
borderpad the fractional whitespace inside the legend border
218219
labelspacing the vertical space between the legend entries
@@ -346,15 +347,15 @@ def __init__(self, parent, handles, labels,
346347
# We use FancyBboxPatch to draw a legend frame. The location
347348
# and size of the box will be updated during the drawing time.
348349

349-
if rcParams["legend.facecolor"] == 'inherit':
350-
facecolor = rcParams["axes.facecolor"]
351-
else:
350+
if facecolor is None:
352351
facecolor = rcParams["legend.facecolor"]
352+
if facecolor == 'inherit':
353+
facecolor = rcParams["axes.facecolor"]
353354

354-
if rcParams["legend.edgecolor"] == 'inherit':
355-
edgecolor = rcParams["axes.edgecolor"]
356-
else:
355+
if edgecolor is None:
357356
edgecolor = rcParams["legend.edgecolor"]
357+
if edgecolor == 'inherit':
358+
edgecolor = rcParams["axes.edgecolor"]
358359

359360
self.legendPatch = FancyBboxPatch(
360361
xy=(0.0, 0.0), width=1., height=1.,

‎lib/matplotlib/rcsetup.py

Copy file name to clipboardExpand all lines: lib/matplotlib/rcsetup.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ def validate_animation_writer_path(p):
11611161
'legend.markerscale': [1.0, validate_float],
11621162
'legend.shadow': [False, validate_bool],
11631163
'legend.facecolor': ['inherit', validate_color_or_inherit],
1164-
'legend.edgecolor': ['none', validate_color_or_inherit],
1164+
'legend.edgecolor': ['0.8', validate_color_or_inherit],
11651165

11661166
# tick properties
11671167
'xtick.top': [False, validate_bool], # draw ticks on the top side

‎matplotlibrc.template

Copy file name to clipboardExpand all lines: matplotlibrc.template
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -404,13 +404,13 @@ backend : $TEMPLATE_BACKEND
404404

405405
### Legend
406406
#legend.loc : best
407-
#legend.frameon : True # whether or not to draw a frame around legend
408-
#legend.framealpha : 0.8 # legend frame transparency
407+
#legend.frameon : True # if True, draw the legend on a background patch
408+
#legend.framealpha : 0.8 # legend patch transparency
409409
#legend.facecolor : inherit # inherit from axes.facecolor; or color spec
410-
#legend.edgecolor : none
410+
#legend.edgecolor : 0.8 # background patch boundary color
411411
#legend.fancybox : True # if True, use a rounded box for the
412-
# legend, else a rectangle
413-
#legend.shadow : False
412+
# legend background, else a rectangle
413+
#legend.shadow : False # if True, give background a shadow effect
414414
#legend.numpoints : 1 # the number of marker points in the legend line
415415
#legend.scatterpoints : 1 # number of scatter points
416416
#legend.markerscale : 1.0 # the relative size of legend markers vs. original

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.