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

Skip to content

Commit 4aade1f

Browse files
committed
Merged revisions 6685 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6685 | leejjoon | 2008-12-19 16:24:32 -0500 (Fri, 19 Dec 2008) | 1 line update legend-related document ........ svn path=/trunk/matplotlib/; revision=6686
1 parent f4cf863 commit 4aade1f

7 files changed

Lines changed: 65 additions & 42 deletions

File tree

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2008-12-19 Update Axes.legend documnetation. /api/api_changes.rst is also
2+
updated to describe chages in keyword parameters.
3+
Issue a warning if old keyword parameters are used. - JJL
4+
15
2008-12-18 add new arrow style, a line + filled triangles. -JJL
26

37
==================================================================

doc/api/api_changes.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@ list may help describe what changes may be necessary in your code.
1515

1616
Changes for 0.98.x
1717
==================
18+
* Following keyword parameters for :class:`matplotlib.label.Label` are now
19+
deprecated and new set of parameters are introduced. The new parameters
20+
are given as a fraction of the font-size. Also, *scatteryoffsets*,
21+
*fancybox* and *columnspacing* are added as keyword parameters.
22+
23+
================ ================
24+
Deprecated New
25+
================ ================
26+
pad borderpad
27+
labelsep labelspacing
28+
handlelen handlelength
29+
handlestextsep handletextpad
30+
axespad borderaxespad
31+
================ ================
32+
33+
1834
* Removed the configobj and experiemtnal traits rc support
1935

2036
* Modified :func:`matplotlib.mlab.psd`, :func:`matplotlib.mlab.csd`,

lib/matplotlib/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,14 @@ def matplotlib_fname():
582582
'tick.size' : 'tick.major.size',
583583
}
584584

585+
_deprecated_ignore_map = {
586+
'legend.pad' : 'legend.borderpad',
587+
'legend.labelsep' : 'legend.labelspacing',
588+
'legend.handlelen' : 'legend.handlelength',
589+
'legend.handletextsep' : 'legend.handletextpad',
590+
'legend.axespad' : 'legend.borderaxespad',
591+
}
592+
585593

586594
class RcParams(dict):
587595

@@ -602,6 +610,10 @@ def __setitem__(self, key, val):
602610
warnings.warn('%s is deprecated in matplotlibrc. Use %s \
603611
instead.'% (key, alt))
604612
key = alt
613+
elif key in _deprecated_ignore_map:
614+
alt = _deprecated_ignore_map[key]
615+
warnings.warn('%s is deprecated. Use %s instead.'% (key, alt))
616+
return
605617
cval = self.validate[key](val)
606618
dict.__setitem__(self, key, cval)
607619
except KeyError:
@@ -665,6 +677,9 @@ def rc_params(fail_on_error=False):
665677
except Exception, msg:
666678
warnings.warn('Bad val "%s" on line #%d\n\t"%s"\n\tin file \
667679
"%s"\n\t%s' % (val, cnt, line, fname, msg))
680+
elif key in _deprecated_ignore_map:
681+
warnings.warn('%s is deprecated. Update your matplotlibrc to use %s instead.'% (key, _deprecated_ignore_map[key]))
682+
668683
else:
669684
print >> sys.stderr, """
670685
Bad key "%s" on line %d in

lib/matplotlib/axes.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3740,31 +3740,27 @@ def legend(self, *args, **kwargs):
37403740
A :class:`matplotlib.font_manager.FontProperties`
37413741
instance, or *None* to use rc settings.
37423742
3743-
*pad*: [ None | scalar ]
3744-
The fractional whitespace inside the legend border, between 0 and 1.
3745-
If *None*, use rc settings.
3746-
37473743
*markerscale*: [ None | scalar ]
37483744
The relative size of legend markers vs. original. If *None*, use rc
37493745
settings.
37503746
37513747
*shadow*: [ None | False | True ]
37523748
If *True*, draw a shadow behind legend. If *None*, use rc settings.
37533749
3754-
*labelsep*: [ None | scalar ]
3755-
The vertical space between the legend entries. If *None*, use rc
3756-
settings.
3757-
3758-
*handlelen*: [ None | scalar ]
3759-
The length of the legend lines. If *None*, use rc settings.
3760-
3761-
*handletextsep*: [ None | scalar ]
3762-
The space between the legend line and legend text. If *None*, use rc
3763-
settings.
3764-
3765-
*axespad*: [ None | scalar ]
3766-
The border between the axes and legend edge. If *None*, use rc
3767-
settings.
3750+
Padding and spacing between various elements use following keywords
3751+
parameters. The dimensions of these values are given as a fraction
3752+
of the fontsize. Values from rcParams will be used if None.
3753+
3754+
================ ==================================================================
3755+
Keyword Description
3756+
================ ==================================================================
3757+
borderpad the fractional whitespace inside the legend border
3758+
labelspacing the vertical space between the legend entries
3759+
handlelength the length of the legend handles
3760+
handletextpad the pad between the legend handle and text
3761+
borderaxespad the pad between the axes and legend border
3762+
columnspacing the spacing between columns
3763+
================ ==================================================================
37683764
37693765
**Example:**
37703766

lib/matplotlib/legend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def __init__(self, parent, handles, labels,
9898
handletextsep = None, # deprecated; use handletextpad
9999
axespad = None, # deprecated; use borderaxespad
100100

101-
# spacing & pad defined as a fractionof the font-size
101+
# spacing & pad defined as a fraction of the font-size
102102
borderpad = None, # the whitespace inside the legend border
103103
labelspacing=None, #the vertical space between the legend entries
104104
handlelength=None, # the length of the legend handles

lib/matplotlib/mpl-data/matplotlib.conf.template

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,19 +233,11 @@ units = False
233233
origin = 'upper'
234234

235235
[legend]
236-
# a float
237-
axespad = 0.02
238236
# a float or 'xx-small' or 'x-small' or 'small' or 'medium' or 'large' or
239237
# 'x-large' or 'xx-large'
240238
fontsize = 'medium'
241-
# a float
242-
handlelen = 0.050000000000000003
243-
# a float
244-
handletextsep = 0.02
245239
# a boolean
246240
isaxes = True
247-
# a float
248-
labelsep = 0.01
249241
# 'best' or 'upper right' or 'upper left' or 'lower left' or 'lower right'
250242
# or 'right' or 'center left' or 'center right' or 'lower center' or
251243
# 'upper center' or 'center'
@@ -254,10 +246,21 @@ units = False
254246
markerscale = 1.0
255247
# an integer
256248
numpoints = 3
257-
# a float
258-
pad = 0.20000000000000001
259249
# a boolean
260250
shadow = False
251+
# float
252+
borderpad = 0.4
253+
# float
254+
labelspacing = 0.5
255+
# float
256+
handlelength = 2.
257+
# float
258+
handletextpad = 0.8
259+
# float
260+
borderaxespad = 0.5
261+
# float
262+
columnspacing = 2.
263+
261264

262265
[lines]
263266
# a boolean

lib/matplotlib/rcsetup.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -432,18 +432,12 @@ def __call__(self, s):
432432
'legend.isaxes' : [True,validate_bool], # this option is internally ignored - it never served any useful purpose
433433
'legend.numpoints' : [2, validate_int], # the number of points in the legend line
434434
'legend.fontsize' : ['large', validate_fontsize],
435-
'legend.pad' : [0, validate_float], # was 0.2, deprecated; the fractional whitespace inside the legend border
436-
'legend.borderpad' : [0.4, validate_float], # units are fontsize
437435
'legend.markerscale' : [1.0, validate_float], # the relative size of legend markers vs. original
438-
439-
# the following dimensions are in axes coords
440-
'legend.labelsep' : [0.010, validate_float], # the vertical space between the legend entries
441-
'legend.handlelen' : [0.05, validate_float], # the length of the legend lines
442-
'legend.handletextsep' : [0.02, validate_float], # the space between the legend line and legend text
443-
'legend.axespad' : [0.02, validate_float], # the border between the axes and legend edge
444436
'legend.shadow' : [False, validate_bool],
445437

446438

439+
# the following dimensions are in fraction of the font size
440+
'legend.borderpad' : [0.4, validate_float], # units are fontsize
447441
'legend.labelspacing' : [0.5, validate_float], # the vertical space between the legend entries
448442
'legend.handlelength' : [2., validate_float], # the length of the legend lines
449443
'legend.handletextpad' : [.8, validate_float], # the space between the legend line and legend text
@@ -453,11 +447,6 @@ def __call__(self, s):
453447

454448
'legend.markerscale' : [1.0, validate_float], # the relative size of legend markers vs. original
455449

456-
# the following dimensions are in axes coords
457-
'legend.labelsep' : [0.010, validate_float], # the vertical space between the legend entries
458-
'legend.handlelen' : [0.05, validate_float], # the length of the legend lines
459-
'legend.handletextsep' : [0.02, validate_float], # the space between the legend line and legend text
460-
'legend.axespad' : [0.5, validate_float], # the border between the axes and legend edge
461450
'legend.shadow' : [False, validate_bool],
462451

463452

0 commit comments

Comments
 (0)