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

Skip to content

Commit 4cf4bfe

Browse files
committed
fixed deprecation warning in legend
svn path=/trunk/matplotlib/; revision=6173
1 parent e9fcc08 commit 4cf4bfe

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

lib/matplotlib/legend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def __init__(self, parent, handles, labels,
124124
value=rcParams["legend."+name]
125125
setattr(self,name,value)
126126
if pad:
127-
warnings.DeprecationWarning("Use 'borderpad' instead of 'pad'.")
127+
warnings.warn("Use 'borderpad' instead of 'pad'.", DeprecationWarning)
128128
# 2008/10/04
129129
if self.numpoints <= 0:
130130
raise ValueError("numpoints must be >= 0; it was %d"% numpoints)

lib/matplotlib/mlab.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,8 +1799,9 @@ def rec_summarize(r, summaryfuncs):
17991799

18001800
def rec_join(key, r1, r2, jointype='inner', defaults=None, r1postfix='1', r2postfix='2'):
18011801
"""
1802-
join record arrays r1 and r2 on key; key is a tuple of field
1803-
names. If r1 and r2 have equal values on all the keys in the key
1802+
join record arrays r1 and r2 on key; key is a tuple of field names
1803+
-- if key is a string it is assumed to be a single attribute
1804+
name. If r1 and r2 have equal values on all the keys in the key
18041805
tuple, then their fields will be merged into a new record array
18051806
containing the intersection of the fields of r1 and r2.
18061807
@@ -1812,10 +1813,13 @@ def rec_join(key, r1, r2, jointype='inner', defaults=None, r1postfix='1', r2post
18121813
The defaults keyword is a dictionary filled with
18131814
{column_name:default_value} pairs.
18141815
1815-
The keywords r1postfix and r2postfix are postfixed to column names
1816+
The keywords r1postfix and r2postfix are postfixed to column names
18161817
(other than keys) that are both in r1 and r2.
18171818
"""
18181819

1820+
if cbook.is_string_like(key):
1821+
key = (key, )
1822+
18191823
for name in key:
18201824
if name not in r1.dtype.names:
18211825
raise ValueError('r1 does not have key field %s'%name)
@@ -1862,7 +1866,7 @@ def key_desc(name):
18621866

18631867

18641868
keydesc = [key_desc(name) for name in key]
1865-
1869+
18661870
def mapped_r1field(name):
18671871
""" the column name in newrec that corresponds to the colmn in r1 """
18681872
if name in key or name not in r2.dtype.names: return name

0 commit comments

Comments
 (0)