Revision: 7446
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7446&view=rev
Author: heeres
Date: 2009-08-11 07:06:15 +0000 (Tue, 11 Aug 2009)
Log Message:
-----------
Fix bugs: #2830483 (axis scaling), 2834105 (z order problem)
Modified Paths:
--------------
branches/v0_99_maint/lib/mpl_toolkits/mplot3d/art3d.py
branches/v0_99_maint/lib/mpl_toolkits/mplot3d/axes3d.py
branches/v0_99_maint/lib/mpl_toolkits/mplot3d/axis3d.py
Modified: branches/v0_99_maint/lib/mpl_toolkits/mplot3d/art3d.py
===================================================================
--- branches/v0_99_maint/lib/mpl_toolkits/mplot3d/art3d.py 2009-08-10
00:47:21 UTC (rev 7445)
+++ branches/v0_99_maint/lib/mpl_toolkits/mplot3d/art3d.py 2009-08-11
07:06:15 UTC (rev 7446)
@@ -217,9 +217,19 @@
def draw(self, renderer):
Patch.draw(self, renderer)
+def get_patch_verts(patch):
+ """Return a list of vertices for the path of a patch."""
+ trans = patch.get_patch_transform()
+ path = patch.get_path()
+ polygons = path.to_polygons(trans)
+ if len(polygons):
+ return polygons[0]
+ else:
+ return []
+
def patch_2d_to_3d(patch, z=0, zdir='z'):
"""Convert a Patch to a Patch3D object."""
- verts = patch.get_verts()
+ verts = get_patch_verts(patch)
patch.__class__ = Patch3D
patch.set_3d_properties(verts, z, zdir)
@@ -333,7 +343,7 @@
if self._zsort:
z_segments_2d = [(np.average(zs), zip(xs, ys), fc, ec) for
(xs, ys, zs), fc, ec in zip(xyzlist, cface, cedge)]
- z_segments_2d.sort(reverse=True)
+ z_segments_2d.sort(cmp=lambda x, y: cmp(y[0], x[0]))
else:
raise ValueError, "whoops"
Modified: branches/v0_99_maint/lib/mpl_toolkits/mplot3d/axes3d.py
===================================================================
--- branches/v0_99_maint/lib/mpl_toolkits/mplot3d/axes3d.py 2009-08-10
00:47:21 UTC (rev 7445)
+++ branches/v0_99_maint/lib/mpl_toolkits/mplot3d/axes3d.py 2009-08-11
07:06:15 UTC (rev 7446)
@@ -200,14 +200,17 @@
def get_w_lims(self):
'''Get 3d world limits.'''
- minpy, maxx = self.get_xlim3d()
+ minx, maxx = self.get_xlim3d()
miny, maxy = self.get_ylim3d()
minz, maxz = self.get_zlim3d()
- return minpy, maxx, miny, maxy, minz, maxz
+ return minx, maxx, miny, maxy, minz, maxz
def _determine_lims(self, xmin=None, xmax=None, *args, **kwargs):
if xmax is None and cbook.iterable(xmin):
xmin, xmax = xmin
+ if xmin == xmax:
+ xmin -= 0.5
+ xmax += 0.5
return (xmin, xmax)
def set_xlim3d(self, *args, **kwargs):
@@ -442,12 +445,12 @@
elif self.button_pressed == 3:
# zoom view
# hmmm..this needs some help from clipping....
- minpy, maxx, miny, maxy, minz, maxz = self.get_w_lims()
+ minx, maxx, miny, maxy, minz, maxz = self.get_w_lims()
df = 1-((h - dy)/h)
- dx = (maxx-minpy)*df
+ dx = (maxx-minx)*df
dy = (maxy-miny)*df
dz = (maxz-minz)*df
- self.set_xlim3d(minpy - dx, maxx + dx)
+ self.set_xlim3d(minx - dx, maxx + dx)
self.set_ylim3d(miny - dy, maxy + dy)
self.set_zlim3d(minz - dz, maxz + dz)
self.get_proj()
@@ -903,13 +906,12 @@
patches = Axes.bar(self, left, height, *args, **kwargs)
if not cbook.iterable(zs):
- zs = np.ones(len(left))*zs
+ zs = np.ones(len(left)) * zs
-
verts = []
verts_zs = []
for p, z in zip(patches, zs):
- vs = p.get_verts()
+ vs = art3d.get_patch_verts(p)
verts += vs.tolist()
verts_zs += [z] * len(vs)
art3d.patch_2d_to_3d(p, zs, zdir)
@@ -933,7 +935,6 @@
had_data = self.has_data()
if not cbook.iterable(x):
- print 'not interable'
x, y, z = [x], [y], [z]
if not cbook.iterable(dx):
dx, dy, dz = [dx], [dy], [dz]
Modified: branches/v0_99_maint/lib/mpl_toolkits/mplot3d/axis3d.py
===================================================================
--- branches/v0_99_maint/lib/mpl_toolkits/mplot3d/axis3d.py 2009-08-10
00:47:21 UTC (rev 7445)
+++ branches/v0_99_maint/lib/mpl_toolkits/mplot3d/axis3d.py 2009-08-11
07:06:15 UTC (rev 7446)
@@ -103,9 +103,6 @@
def get_major_ticks(self):
ticks = maxis.XAxis.get_major_ticks(self)
for t in ticks:
- def update_coords(renderer, self=t.label1):
- return text_update_coords(self, renderer)
- # Text overrides setattr so need this to force new method
t.tick1line.set_transform(self.axes.transData)
t.tick2line.set_transform(self.axes.transData)
t.gridline.set_transform(self.axes.transData)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins