Revision: 4782
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4782&view=rev
Author:   mdboom
Date:     2007-12-20 09:18:12 -0800 (Thu, 20 Dec 2007)

Log Message:
-----------
Major speed improvement for non-rectilinear projections.

Modified Paths:
--------------
    branches/transforms/lib/matplotlib/axis.py
    branches/transforms/lib/matplotlib/lines.py
    branches/transforms/lib/matplotlib/transforms.py

Modified: branches/transforms/lib/matplotlib/axis.py
===================================================================
--- branches/transforms/lib/matplotlib/axis.py  2007-12-20 17:14:36 UTC (rev 
4781)
+++ branches/transforms/lib/matplotlib/axis.py  2007-12-20 17:18:12 UTC (rev 
4782)
@@ -304,6 +304,11 @@
         'Set the location of tick in data coords with scalar loc'
         x = loc
 
+        nonlinear = (hasattr(self.axes, 'yaxis') and
+                     self.axes.yaxis.get_scale() != 'linear' or
+                     hasattr(self.axes, 'xaxis') and
+                     self.axes.xaxis.get_scale() != 'linear')
+
         if self.tick1On:
             self.tick1line.set_xdata((x,))
         if self.tick2On:
@@ -314,6 +319,12 @@
             self.label1.set_x(x)
         if self.label2On:
             self.label2.set_x(x)
+
+        if nonlinear:
+            self.tick1line._invalid = True
+            self.tick2line._invalid = True
+            self.gridline._invalid = True
+
         self._loc = loc
 
     def get_view_interval(self):
@@ -425,6 +436,12 @@
     def update_position(self, loc):
         'Set the location of tick in data coords with scalar loc'
         y = loc
+
+        nonlinear = (hasattr(self.axes, 'yaxis') and
+                     self.axes.yaxis.get_scale() != 'linear' or
+                     hasattr(self.axes, 'xaxis') and
+                     self.axes.xaxis.get_scale() != 'linear')
+
         if self.tick1On:
             self.tick1line.set_ydata((y,))
         if self.tick2On:
@@ -435,6 +452,11 @@
             self.label1.set_y( y )
         if self.label2On:
             self.label2.set_y( y )
+        if nonlinear:
+            self.tick1line._invalid = True
+            self.tick2line._invalid = True
+            self.gridline._invalid = True
+
         self._loc = loc
 
 

Modified: branches/transforms/lib/matplotlib/lines.py
===================================================================
--- branches/transforms/lib/matplotlib/lines.py 2007-12-20 17:14:36 UTC (rev 
4781)
+++ branches/transforms/lib/matplotlib/lines.py 2007-12-20 17:18:12 UTC (rev 
4782)
@@ -396,9 +396,6 @@
             self._xorig = x
             self._yorig = y
             self._invalid = True
-        else:
-            if hasattr(self, "_transformed_path"):
-                self._transformed_path._invalid = 
self._transformed_path.INVALID_NON_AFFINE
 
     def recache(self):
         #if self.axes is None: print 'recache no axes'

Modified: branches/transforms/lib/matplotlib/transforms.py
===================================================================
--- branches/transforms/lib/matplotlib/transforms.py    2007-12-20 17:14:36 UTC 
(rev 4781)
+++ branches/transforms/lib/matplotlib/transforms.py    2007-12-20 17:18:12 UTC 
(rev 4782)
@@ -93,22 +93,24 @@
         """
         # If we are an affine transform being changed, we can set the
         # flag to INVALID_AFFINE_ONLY
-        value = ((self.is_affine or self.is_bbox)
-                 and self.INVALID_AFFINE
-                 or self.INVALID)
+        value = (self.is_affine) and self.INVALID_AFFINE or self.INVALID
 
         # Shortcut: If self is already invalid, that means its parents
         # are as well, so we don't need to do anything.
-        if self._invalid == value or not len(self._parents):
+        if self._invalid == value:
             return
 
+        if not len(self._parents):
+            self._invalid = value
+            return
+
         # Invalidate all ancestors of self using pseudo-recursion.
         parent = None
         stack = [self]
         while len(stack):
             root = stack.pop()
             # Stop at subtrees that have already been invalidated
-            if root._invalid == 0 or root.pass_through:
+            if root._invalid != value or root.pass_through:
                 root._invalid = value
                 stack.extend(root._parents.keys())
 
@@ -198,6 +200,7 @@
     read-only access to its data.
     """
     is_bbox = True
+    is_affine = True
 
     #* Redundant: Removed for performance
     #
@@ -208,6 +211,7 @@
         def _check(points):
             if ma.isMaskedArray(points):
                 warnings.warn("Bbox bounds are a masked array.")
+            points = npy.asarray(points)
             if (points[1,0] - points[0,0] == 0 or
                 points[1,1] - points[0,1] == 0):
                 warnings.warn("Singular Bbox.")
@@ -1011,6 +1015,8 @@
     transform may only be replaced with another child transform of the
     same dimensions.
     """
+    pass_through = True
+
     def __init__(self, child):
         """
         child: A Transform instance.  This child may later be replaced
@@ -1546,7 +1552,6 @@
     This version is an optimization for the case where both child
     transforms are of type Affine2DBase.
     """
-
     is_separable = True
 
     def __init__(self, x_transform, y_transform):
@@ -1917,8 +1922,8 @@
         the transform already applied, along with the affine part of
         the path necessary to complete the transformation.
         """
-        if (self._invalid & self.INVALID_NON_AFFINE or
-            self._transformed_path is None):
+        if ((self._invalid & self.INVALID_NON_AFFINE == 
self.INVALID_NON_AFFINE)
+            or self._transformed_path is None):
             self._transformed_path = \
                 self._transform.transform_path_non_affine(self._path)
         self._invalid = 0
@@ -1928,7 +1933,7 @@
         """
         Return a fully-transformed copy of the child path.
         """
-        if (self._invalid & self.INVALID_NON_AFFINE
+        if ((self._invalid & self.INVALID_NON_AFFINE == 
self.INVALID_NON_AFFINE)
             or self._transformed_path is None):
             self._transformed_path = \
                 self._transform.transform_path_non_affine(self._path)


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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to