Skip to content

Commit 9f2cb13

Browse files
committed
Merge branch 'v1.2.x' of github.com:matplotlib/matplotlib
* 'v1.2.x' of github.com:matplotlib/matplotlib: Alternative to matplotlib#1404. Sets the cursor without refering to a FigureManager Update version numbers Exception message improvement. Fixed transform=None behaviour on Artists. Add trove classifiers to setup.py Fix AttrituteError for .lower on tuple of strings Tables: Fix get_window_extent for table to allow table to be added to bbox_extra_artists. The get_window_extent is a method on the cells not the key of the cells. Conflicts: lib/matplotlib/__init__.py
2 parents 4e6b2c0 + e4705f9 commit 9f2cb13

File tree

9 files changed

+118
-17
lines changed

9 files changed

+118
-17
lines changed

LICENSE/LICENSE

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
LICENSE AGREEMENT FOR MATPLOTLIB 1.1.0
1+
LICENSE AGREEMENT FOR MATPLOTLIB 1.2.0
22
--------------------------------------
33

44
1. This LICENSE AGREEMENT is between John D. Hunter ("JDH"), and the
@@ -9,30 +9,30 @@ documentation.
99
2. Subject to the terms and conditions of this License Agreement, JDH
1010
hereby grants Licensee a nonexclusive, royalty-free, world-wide license
1111
to reproduce, analyze, test, perform and/or display publicly, prepare
12-
derivative works, distribute, and otherwise use matplotlib 1.1.0
12+
derivative works, distribute, and otherwise use matplotlib 1.2.0
1313
alone or in any derivative version, provided, however, that JDH's
1414
License Agreement and JDH's notice of copyright, i.e., "Copyright (c)
1515
2002-2011 John D. Hunter; All Rights Reserved" are retained in
16-
matplotlib 1.1.0 alone or in any derivative version prepared by
16+
matplotlib 1.2.0 alone or in any derivative version prepared by
1717
Licensee.
1818

1919
3. In the event Licensee prepares a derivative work that is based on or
20-
incorporates matplotlib 1.1.0 or any part thereof, and wants to
20+
incorporates matplotlib 1.2.0 or any part thereof, and wants to
2121
make the derivative work available to others as provided herein, then
2222
Licensee hereby agrees to include in any such work a brief summary of
23-
the changes made to matplotlib 1.1.0.
23+
the changes made to matplotlib 1.2.0.
2424

25-
4. JDH is making matplotlib 1.1.0 available to Licensee on an "AS
25+
4. JDH is making matplotlib 1.2.0 available to Licensee on an "AS
2626
IS" basis. JDH MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
2727
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, JDH MAKES NO AND
2828
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
29-
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 1.1.0
29+
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 1.2.0
3030
WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
3131

3232
5. JDH SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB
33-
1.1.0 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR
33+
1.2.0 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR
3434
LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING
35-
MATPLOTLIB 1.1.0, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF
35+
MATPLOTLIB 1.2.0, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF
3636
THE POSSIBILITY THEREOF.
3737

3838
6. This License Agreement will automatically terminate upon a material
@@ -44,6 +44,6 @@ Licensee. This License Agreement does not grant permission to use JDH
4444
trademarks or trade name in a trademark sense to endorse or promote
4545
products or services of Licensee, or any third party.
4646

47-
8. By copying, installing or otherwise using matplotlib 1.1.0,
47+
8. By copying, installing or otherwise using matplotlib 1.2.0,
4848
Licensee agrees to be bound by the terms and conditions of this License
4949
Agreement.

lib/matplotlib/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,7 @@ def tk_window_focus():
10661066

10671067
default_test_modules = [
10681068
'matplotlib.tests.test_agg',
1069+
'matplotlib.tests.test_artist',
10691070
'matplotlib.tests.test_axes',
10701071
'matplotlib.tests.test_backend_svg',
10711072
'matplotlib.tests.test_backend_pgf',

lib/matplotlib/artist.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def set_transform(self, t):
231231
ACCEPTS: :class:`~matplotlib.transforms.Transform` instance
232232
"""
233233
self._transform = t
234-
self._transformSet = t is not None
234+
self._transformSet = True
235235
self.pchanged()
236236

237237
def get_transform(self):
@@ -240,7 +240,7 @@ def get_transform(self):
240240
instance used by this artist.
241241
"""
242242
if self._transform is None:
243-
self._transform = IdentityTransform()
243+
self.set_transform(IdentityTransform())
244244
elif (not isinstance(self._transform, Transform)
245245
and hasattr(self._transform, '_as_mpl_transform')):
246246
self._transform = self._transform._as_mpl_transform(self.axes)
@@ -663,6 +663,7 @@ def update(self, props):
663663
store = self.eventson
664664
self.eventson = False
665665
changed = False
666+
666667
for k, v in props.iteritems():
667668
func = getattr(self, 'set_' + k, None)
668669
if func is None or not callable(func):

lib/matplotlib/axes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,7 @@ def set_anchor(self, anchor):
11201120
self._anchor = anchor
11211121
else:
11221122
raise ValueError('argument must be among %s' %
1123-
', '.join(mtransforms.BBox.coefs.keys()))
1123+
', '.join(mtransforms.Bbox.coefs.keys()))
11241124

11251125
def get_data_ratio(self):
11261126
"""
@@ -7347,8 +7347,9 @@ def pcolor(self, *args, **kwargs):
73477347
# makes artifacts that are often disturbing.
73487348
if 'antialiased' in kwargs:
73497349
kwargs['antialiaseds'] = kwargs.pop('antialiased')
7350-
if 'antialiaseds' not in kwargs and ec.lower() == "none":
7351-
kwargs['antialiaseds'] = False
7350+
if 'antialiaseds' not in kwargs and (is_string_like(ec) and
7351+
ec.lower() == "none"):
7352+
kwargs['antialiaseds'] = False
73527353

73537354

73547355
collection = mcoll.PolyCollection(verts, **kwargs)

lib/matplotlib/backends/backend_qt4.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ def set_message( self, s ):
603603

604604
def set_cursor( self, cursor ):
605605
if DEBUG: print('Set cursor' , cursor)
606-
self.canvas.manager.window.setCursor(cursord[cursor])
606+
self.canvas.window().setCursor(cursord[cursor])
607607

608608
def draw_rubberband( self, event, x0, y0, x1, y1 ):
609609
height = self.canvas.figure.bbox.height

lib/matplotlib/streamplot.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
6565
mask = StreamMask(density)
6666
dmap = DomainMap(grid, mask)
6767

68+
# default to data coordinates
69+
if transform is None:
70+
transform = axes.transData
71+
6872
if color is None:
6973
color = axes._get_lines.color_cycle.next()
7074

lib/matplotlib/table.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,9 @@ def get_children(self):
279279

280280
def get_window_extent(self, renderer):
281281
'Return the bounding box of the table in window coords'
282-
boxes = [c.get_window_extent(renderer) for c in self._cells]
282+
boxes = [cell.get_window_extent(renderer)
283+
for cell in self._cells.values()]
284+
283285
return Bbox.union(boxes)
284286

285287
def _do_cell_alignment(self):
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
from __future__ import print_function
2+
3+
from matplotlib.testing.decorators import cleanup
4+
5+
import matplotlib.pyplot as plt
6+
7+
import matplotlib.patches as mpatches
8+
import matplotlib.transforms as mtrans
9+
import matplotlib.collections as mcollections
10+
11+
12+
@cleanup
13+
def test_patch_transform_of_none():
14+
# tests the behaviour of patches added to an Axes with various transform
15+
# specifications
16+
17+
ax = plt.axes()
18+
ax.set_xlim([1, 3])
19+
ax.set_ylim([1, 3])
20+
21+
#draw an ellipse over data coord (2,2) by specifying device coords
22+
xy_data = (2, 2)
23+
xy_pix = ax.transData.transform_point(xy_data)
24+
25+
# not providing a transform of None puts the ellipse in data coordinates
26+
e = mpatches.Ellipse(xy_data, width=1, height=1, fc='yellow', alpha=0.5)
27+
ax.add_patch(e)
28+
assert e._transform == ax.transData
29+
30+
# providing a transform of None puts the ellipse in device coordinates
31+
e = mpatches.Ellipse(xy_pix, width=120, height=120, fc='coral',
32+
transform=None, alpha=0.5)
33+
ax.add_patch(e)
34+
assert isinstance(e._transform, mtrans.IdentityTransform)
35+
36+
# providing an IdentityTransform puts the ellipse in device coordinates
37+
e = mpatches.Ellipse(xy_pix, width=100, height=100,
38+
transform=mtrans.IdentityTransform(), alpha=0.5)
39+
ax.add_patch(e)
40+
assert isinstance(e._transform, mtrans.IdentityTransform)
41+
42+
43+
@cleanup
44+
def test_collection_transform_of_none():
45+
# tests the behaviour of collections added to an Axes with various
46+
# transform specifications
47+
48+
ax = plt.axes()
49+
ax.set_xlim([1, 3])
50+
ax.set_ylim([1, 3])
51+
52+
#draw an ellipse over data coord (2,2) by specifying device coords
53+
xy_data = (2, 2)
54+
xy_pix = ax.transData.transform_point(xy_data)
55+
56+
# not providing a transform of None puts the ellipse in data coordinates
57+
e = mpatches.Ellipse(xy_data, width=1, height=1)
58+
c = mcollections.PatchCollection([e], facecolor='yellow', alpha=0.5)
59+
ax.add_collection(c)
60+
# the collection should be in data coordinates
61+
assert c.get_offset_transform() + c.get_transform() == ax.transData
62+
63+
# providing a transform of None puts the ellipse in device coordinates
64+
e = mpatches.Ellipse(xy_pix, width=120, height=120)
65+
c = mcollections.PatchCollection([e], facecolor='coral',
66+
alpha=0.5)
67+
c.set_transform(None)
68+
ax.add_collection(c)
69+
assert isinstance(c.get_transform(), mtrans.IdentityTransform)
70+
71+
# providing an IdentityTransform puts the ellipse in device coordinates
72+
e = mpatches.Ellipse(xy_pix, width=100, height=100)
73+
c = mcollections.PatchCollection([e], transform=mtrans.IdentityTransform(),
74+
alpha=0.5)
75+
ax.add_collection(c)
76+
assert isinstance(c._transOffset, mtrans.IdentityTransform)
77+
78+
79+
if __name__=='__main__':
80+
import nose
81+
nose.runmodule(argv=['-s','--with-doctest'], exit=False)

setup.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@
7373

7474
ext_modules = []
7575

76+
classifiers = [
77+
'Development Status :: 5 - Production/Stable',
78+
'Intended Audience :: Science/Research',
79+
'License :: OSI Approved :: Python Software Foundation License',
80+
'Programming Language :: Python',
81+
'Programming Language :: Python :: 2',
82+
'Programming Language :: Python :: 3',
83+
'Topic :: Scientific/Engineering :: Visualization',
84+
]
85+
7686
for line in open('lib/matplotlib/__init__.py').readlines():
7787
if (line.startswith('__version__')):
7888
exec(line.strip())
@@ -319,6 +329,7 @@ def run_2to3(self, files):
319329
ext_modules = ext_modules,
320330
package_dir = package_dir,
321331
package_data = package_data,
332+
classifiers = classifiers,
322333
cmdclass = {'build_py': build_py},
323334
**additional_params
324335
)

0 commit comments

Comments
 (0)