Mike (or other transforms afficionados),

The thread "[Matplotlib-users] Bug saving semilogy plots with a axvline" 
started by [EMAIL PROTECTED] pointed to a bug that appears to be deep in 
the transforms code.  My head is spinning.  The problem seems to be 
related to the propagation of the _invalid attribute in transforms, in 
the case of a mixed data/axes transform such as ashline uses.  The 
following one-line change in TransformNode, second line from the bottom, 
works:

     def invalidate(self):
         """
         Invalidate this :class:`TransformNode` and all of its
         ancestors.  Should be called any time the transform changes.
         """
         # If we are an affine transform being changed, we can set the
         # flag to INVALID_AFFINE_ONLY
         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:
             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 != value or root.pass_through:
                 root._invalid = self.INVALID # value  <===========
                 stack.extend(root._parents.keys())

Now, I know this is the wrong solution, because it defeats all the 
cleverness with the _invalid values; but perhaps it will save you a few 
minutes in finding the right solution.

To reproduce the problem, do this in ipython -pylab:

axhline(5)
yscale('log')
ylim(0.5,30)

Eric

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to