Revision: 8041
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8041&view=rev
Author:   heeres
Date:     2009-12-20 08:03:40 +0000 (Sun, 20 Dec 2009)

Log Message:
-----------
mplot3d: fix axes juggle issue, fix ticks on end of axes range

Modified Paths:
--------------
    trunk/matplotlib/examples/mplot3d/polys3d_demo.py
    trunk/matplotlib/examples/mplot3d/surface3d_demo3.py
    trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py
    trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py
    trunk/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py

Modified: trunk/matplotlib/examples/mplot3d/polys3d_demo.py
===================================================================
--- trunk/matplotlib/examples/mplot3d/polys3d_demo.py   2009-12-18 22:25:35 UTC 
(rev 8040)
+++ trunk/matplotlib/examples/mplot3d/polys3d_demo.py   2009-12-20 08:03:40 UTC 
(rev 8041)
@@ -22,8 +22,11 @@
 poly.set_alpha(0.7)
 ax.add_collection3d(poly, zs=zs, zdir='y')
 
+ax.set_xlabel('X')
 ax.set_xlim3d(0, 10)
+ax.set_ylabel('Y')
 ax.set_ylim3d(-1, 4)
+ax.set_zlabel('Z')
 ax.set_zlim3d(0, 1)
 
 plt.show()

Modified: trunk/matplotlib/examples/mplot3d/surface3d_demo3.py
===================================================================
--- trunk/matplotlib/examples/mplot3d/surface3d_demo3.py        2009-12-18 
22:25:35 UTC (rev 8040)
+++ trunk/matplotlib/examples/mplot3d/surface3d_demo3.py        2009-12-20 
08:03:40 UTC (rev 8041)
@@ -23,8 +23,8 @@
 surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, facecolors=colors,
         linewidth=0, antialiased=False)
 
-ax.set_zlim3d(-1.01, 1.01)
-ax.w_zaxis.set_major_locator(LinearLocator(10))
+ax.set_zlim3d(-1, 1)
+ax.w_zaxis.set_major_locator(LinearLocator(6))
 ax.w_zaxis.set_major_formatter(FormatStrFormatter('%.03f'))
 
 plt.show()

Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py  2009-12-18 22:25:35 UTC 
(rev 8040)
+++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py  2009-12-20 08:03:40 UTC 
(rev 8041)
@@ -434,9 +434,26 @@
 
 def juggle_axes(xs, ys, zs, zdir):
     """
-    Reorder coordinates so that zdir
+    Reorder coordinates so that 2D xs, ys can be plotted in the plane
+    orthogonal to zdir. zdir is normally x, y or z. However, if zdir
+    starts with a '-' it is interpreted as a compensation for rotate_axes.
     """
     if zdir == 'x':
+        return zs, xs, ys
+    elif zdir == 'y':
+        return xs, zs, ys
+    elif zdir[0] == '-':
+        return rotate_axes(xs, ys, zs, zdir)
+    else:
+        return xs, ys, zs
+
+def rotate_axes(xs, ys, zs, zdir):
+    """
+    Reorder coordinates so that the axes are rotated with zdir along
+    the original z axis. Prepending the axis with a '-' does the
+    inverse transform, so zdir can be x, -x, y, -y, z or -z
+    """
+    if zdir == 'x':
         return ys, zs, xs
     elif zdir == '-x':
         return zs, xs, ys

Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2009-12-18 22:25:35 UTC 
(rev 8040)
+++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2009-12-20 08:03:40 UTC 
(rev 8041)
@@ -857,7 +857,7 @@
 
         had_data = self.has_data()
 
-        jX, jY, jZ = art3d.juggle_axes(X, Y, Z, zdir)
+        jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
         cset = Axes.contour(self, jX, jY, jZ, **kwargs)
 
         zdir = '-' + zdir

Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py 2009-12-18 22:25:35 UTC 
(rev 8040)
+++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py 2009-12-20 08:03:40 UTC 
(rev 8041)
@@ -180,7 +180,7 @@
         # filter locations here so that no extra grid lines are drawn
         interval = self.get_view_interval()
         majorLocs = [loc for loc in majorLocs if \
-                interval[0] < loc < interval[1]]
+                interval[0] <= loc <= interval[1]]
         self.major.formatter.set_locs(majorLocs)
         majorLabels = [self.major.formatter(val, i)
                        for i, val in enumerate(majorLocs)]


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to