Revision: 3925
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3925&view=rev
Author:   mdboom
Date:     2007-10-05 12:37:18 -0700 (Fri, 05 Oct 2007)

Log Message:
-----------
Merged revisions 3909-3924 via svnmerge from 
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib

........
  r3910 | jrevans | 2007-10-03 18:23:48 -0400 (Wed, 03 Oct 2007) | 4 lines
  
  Moved a couple of routines from the Agg version of the FigureCanvas to the 
base qt
  version where they belong.  Added a couple of overloaded qt methods that 
should be
  there and reduce having to inherit when embedding in another QWidget.
........
  r3911 | jrevans | 2007-10-03 19:05:30 -0400 (Wed, 03 Oct 2007) | 3 lines
  
  Removed an erroneous print statment in backend_qt.py.
  Added a feature to keep track of axes inversions.
........
  r3916 | sameerd | 2007-10-04 17:39:07 -0400 (Thu, 04 Oct 2007) | 3 lines
  
  Fix for "NameError: global name 'ones' is not defined"
........
  r3917 | jrevans | 2007-10-04 18:13:18 -0400 (Thu, 04 Oct 2007) | 5 lines
  
  axes.py: Reverted get/set xlim/ylim methods to original state
           Added get/set xbound/ybound to handle axes inversion maintenance
           Removed inverted axes flags
  patches.py: Added some logic to xform an Ellipse angle as per the Ellipse's 
transformation.
........
  r3918 | efiring | 2007-10-05 02:18:25 -0400 (Fri, 05 Oct 2007) | 2 lines
  
  Minor cleanup of arguments and docstring in contour
........
  r3919 | efiring | 2007-10-05 02:58:15 -0400 (Fri, 05 Oct 2007) | 2 lines
  
  Tweaked automatic contour level calculation
........
  r3920 | jrevans | 2007-10-05 12:29:17 -0400 (Fri, 05 Oct 2007) | 2 lines
  
  Fixed a typo in the Ellipse code that was causing the ellipse angle to go in 
the wrong direction.  When I was testing I had forgotten to turn off the axes 
inversion test.
........
  r3921 | jrevans | 2007-10-05 13:01:36 -0400 (Fri, 05 Oct 2007) | 2 lines
  
  Fixed an error in calculating the mid-point of a bar since the values are now 
lists and not arrays, they need to be iterated to perform the arithmetic.
........
  r3923 | dsdale | 2007-10-05 14:56:10 -0400 (Fri, 05 Oct 2007) | 1 line
  
  remove generator expressions from texmanager and mpltraits
........

Modified Paths:
--------------
    branches/transforms/CHANGELOG
    branches/transforms/examples/simple_plot.py
    branches/transforms/lib/matplotlib/axes.py
    branches/transforms/lib/matplotlib/config/mpltraits.py
    branches/transforms/lib/matplotlib/contour.py
    branches/transforms/lib/matplotlib/texmanager.py
    branches/transforms/lib/matplotlib/ticker.py

Property Changed:
----------------
    branches/transforms/


Property changes on: branches/transforms
___________________________________________________________________
Name: svnmerge-integrated
   - /trunk/matplotlib:1-3908
   + /trunk/matplotlib:1-3924

Modified: branches/transforms/CHANGELOG
===================================================================
--- branches/transforms/CHANGELOG       2007-10-05 19:25:33 UTC (rev 3924)
+++ branches/transforms/CHANGELOG       2007-10-05 19:37:18 UTC (rev 3925)
@@ -1,3 +1,6 @@
+2007-10-05 remove generator expressions from texmanager and mpltraits. 
+           generator expressions are not supported by python-2.3 - DSD
+
 2007-10-01 Made matplotlib.use() raise an exception if called after
            backends has been imported.
 

Modified: branches/transforms/examples/simple_plot.py
===================================================================
--- branches/transforms/examples/simple_plot.py 2007-10-05 19:25:33 UTC (rev 
3924)
+++ branches/transforms/examples/simple_plot.py 2007-10-05 19:37:18 UTC (rev 
3925)
@@ -17,4 +17,6 @@
 #savefig('simple_plot.png')
 savefig('simple_plot')
 
+axes().set_xlim(5, -5)
+
 show()

Modified: branches/transforms/lib/matplotlib/axes.py
===================================================================
--- branches/transforms/lib/matplotlib/axes.py  2007-10-05 19:25:33 UTC (rev 
3924)
+++ branches/transforms/lib/matplotlib/axes.py  2007-10-05 19:37:18 UTC (rev 
3925)
@@ -844,9 +844,9 @@
             return
 
 
-        xmin,xmax = self.get_xlim()
+        xmin,xmax = self.get_xbound()
         xsize = max(math.fabs(xmax-xmin), 1e-30)
-        ymin,ymax = self.get_ylim()
+        ymin,ymax = self.get_ybound()
         ysize = max(math.fabs(ymax-ymin), 1e-30)
         
         l,b,w,h = self.get_position(original=True).bounds
@@ -895,14 +895,14 @@
             yc = 0.5*(ymin+ymax)
             y0 = yc - Ysize/2.0
             y1 = yc + Ysize/2.0
-            self.set_ylim((y0, y1))
+            self.set_ybound((y0, y1))
             #print 'New y0, y1:', y0, y1
             #print 'New ysize, ysize/xsize', y1-y0, (y1-y0)/xsize
         else:
             xc = 0.5*(xmin+xmax)
             x0 = xc - Xsize/2.0
             x1 = xc + Xsize/2.0
-            self.set_xlim((x0, x1))
+            self.set_xbound((x0, x1))
             #print 'New x0, x1:', x0, x1
             #print 'New xsize, ysize/xsize', x1-x0, ysize/(x1-x0)
 
@@ -1186,24 +1186,20 @@
                       len(self.lines)==0 and
                       len(self.patches)==0)):
 
-            if scalex: self.set_xlim(self.dataLim.intervalx().get_bounds())
+            if scalex: self.set_xbound(self.dataLim.intervalx().get_bounds())
 
-            if scaley: self.set_ylim(self.dataLim.intervaly().get_bounds())
+            if scaley: self.set_ybound(self.dataLim.intervaly().get_bounds())
             return
 
         if scalex:
-            xl = self.get_xlim()
+            xl = self.get_xbound()
             XL = self.xaxis.get_major_locator().autoscale()
-            if xl[1] < xl[0]:
-                XL = XL[::-1]
-            self.set_xlim(XL)
+            self.set_xbound(XL)
         if scaley:
             ylocator = self.yaxis.get_major_locator()
-            yl = self.get_ylim()
+            yl = self.get_ybound()
             YL = ylocator.autoscale()
-            if yl[1] < yl[0]:
-                YL = YL[::-1]
-            self.set_ylim(YL)
+            self.set_ybound(YL)
 
     #### Drawing
     def draw(self, renderer=None, inframe=False):
@@ -1427,14 +1423,47 @@
 
     ### data limits, ticks, tick labels, and formatting
             
-    def invert_xaxis(self, invert=True):
-        "Invert the x-axis if 'invert' is True."
-        self._invertedx = invert
+    def invert_xaxis(self):
+        "Invert the x-axis."
+        left, right = self.get_xlim()
+        self.set_xlim(right, left)
 
     def xaxis_inverted(self):
         'Returns True if the x-axis is inverted.'
-        return self._invertedx
+        left, right = self.get_xlim()
+        return right < left
 
+    def get_xbound(self):
+        "Returns the x-axis numerical bounds in the form of lowerBound < 
upperBound"
+        left, right = self.get_xlim()
+        if left < right:
+           return left, right
+        else:
+           return right, left
+
+    def set_xbound(self, lower=None, upper=None):
+        """Set the lower and upper numerical bounds of the x-axis.
+           This method will honor axes inversion regardless of parameter order.
+        """
+        if upper is None and iterable(lower):
+            lower,upper = lower
+
+        old_lower,old_upper = self.get_xbound()
+
+        if lower is None: lower = old_lower
+        if upper is None: upper = old_upper
+
+        if self.xaxis_inverted():
+            if lower < upper:
+                self.set_xlim(upper, lower)
+            else:
+                self.set_xlim(lower, upper)
+        else:
+            if lower < upper:
+                self.set_xlim(lower, upper)
+            else:
+                self.set_xlim(upper, lower)
+
     def get_xlim(self):
         """Get the x-axis range [xmin, xmax]
 
@@ -1483,21 +1512,9 @@
         if xmin is None: xmin = old_xmin
         if xmax is None: xmax = old_xmax
 
-        # provided for backwards compatability
-        if ( xmax < xmin ):
-            # swap the values so that xmin < xmax and set inverted flag
-            tmp = xmin
-            xmin = xmax
-            xmax = tmp
-            self.invert_xaxis( True )
-
-        if ( self._invertedx ):
-            xmax, xmin = mtransforms.nonsingular(xmax, xmin, increasing=False)
-            self.viewLim.intervalx = (xmax, xmin)
-        else:
-            xmin, xmax = mtransforms.nonsingular(xmin, xmax, increasing=False)
-            self.viewLim.intervalx = (xmin, xmax)
-
+        xmax, xmin = mtransforms.nonsingular(xmax, xmin, increasing=False)
+        self.viewLim.intervalx = (xmin, xmax)
+        
         if emit:
            self.callbacks.process('xlim_changed', self)
            # Call all of the other x-axes that are shared with this one
@@ -1566,14 +1583,47 @@
         return self.xaxis.set_ticklabels(labels, fontdict, **kwargs)
     set_xticklabels.__doc__ = cbook.dedent(set_xticklabels.__doc__) % 
martist.kwdocd
 
-    def invert_yaxis(self, invert=True):
-        "Invert the y-axis if 'invert' is True."
-        self._invertedy = invert
+    def invert_yaxis(self):
+        "Invert the y-axis."
+        left, right = self.get_ylim()
+        self.set_ylim(right, left)
 
     def yaxis_inverted(self):
         'Returns True if the y-axis is inverted.'
-        return self._invertedy
+        left, right = self.get_ylim()
+        return right < left
 
+    def get_ybound(self):
+        "Returns the y-axis numerical bounds in the form of lowerBound < 
upperBound"
+        left, right = self.get_ylim()
+        if left < right:
+           return left, right
+        else:
+           return right, left
+
+    def set_ybound(self, lower=None, upper=None):
+        """Set the lower and upper numerical bounds of the y-axis.
+           This method will honor axes inversion regardless of parameter order.
+        """
+        if upper is None and iterable(lower):
+            lower,upper = lower
+
+        old_lower,old_upper = self.get_ybound()
+
+        if lower is None: lower = old_lower
+        if upper is None: upper = old_upper
+
+        if self.yaxis_inverted():
+            if lower < upper:
+                self.set_ylim(upper, lower)
+            else:
+                self.set_ylim(lower, upper)
+        else:
+            if lower < upper:
+                self.set_ylim(lower, upper)
+            else:
+                self.set_ylim(upper, lower)
+
     def get_ylim(self):
         """Get the y-axis range [xmin, xmax]
 
@@ -1620,21 +1670,9 @@
         if ymin is None: ymin = old_ymin
         if ymax is None: ymax = old_ymax
 
-        # provided for backwards compatability
-        if ( ymax < ymin ):
-            # swap the values so that ymin < ymax and set inverted flag
-            tmp = ymin
-            ymin = ymax
-            ymax = tmp
-            self.invert_yaxis( True )
+        ymin, ymax = mtransforms.nonsingular(ymin, ymax, increasing=False)
+        self.viewLim.intervaly = (ymin, ymax)
 
-        if ( self._invertedy ):
-            ymax, ymin = mtransforms.nonsingular(ymax, ymin, increasing=False)
-            self.viewLim.intervaly = (ymax, ymin)
-        else:
-            ymin, ymax = mtransforms.nonsingular(ymin, ymax, increasing=False)
-            self.viewLim.intervaly = (ymin, ymax)
-
         if emit:
            self.callbacks.process('ylim_changed', self)
            # Call all of the other y-axes that are shared with this one
@@ -2357,9 +2395,9 @@
         y = npy.asarray(y)
 
         if len(xmin)==1:
-            xmin = xmin*ones(y.shape, y.dtype)
+            xmin = xmin*npy.ones(y.shape, y.dtype)
         if len(xmax)==1:
-            xmax = xmax*ones(y.shape, y.dtype)
+            xmax = xmax*npy.ones(y.shape, y.dtype)
 
         xmin = npy.asarray(xmin)
         xmax = npy.asarray(xmax)
@@ -3199,9 +3237,9 @@
             pass
         elif align == 'center':
             if orientation == 'vertical':
-                left = left - width/2.
+                left = [left[i] - width[i]/2. for i in range(len(left))]
             elif orientation == 'horizontal':
-                bottom = bottom-height/2.
+                bottom = [bottom[i] - height[i]/2. for i in range(len(bottom))]
 
         else:
             raise ValueError, 'invalid alignment: %s' % align

Modified: branches/transforms/lib/matplotlib/config/mpltraits.py
===================================================================
--- branches/transforms/lib/matplotlib/config/mpltraits.py      2007-10-05 
19:25:33 UTC (rev 3924)
+++ branches/transforms/lib/matplotlib/config/mpltraits.py      2007-10-05 
19:37:18 UTC (rev 3925)
@@ -46,7 +46,7 @@
     def info(self):
         be = self.backends.keys()
         be.sort
-        return "one of %s"% ', '.join('%s'%i for i in be)
+        return "one of %s"% ', '.join(['%s'%i for i in be])
 
 
 class BoolHandler(T.TraitHandler):
@@ -73,7 +73,7 @@
             return self.error(object, name, value)
 
     def info(self):
-        return "one of %s"% ', '.join('%s'%i for i in self.bools.keys())
+        return "one of %s"% ', '.join(['%s'%i for i in self.bools.keys()])
 
 flexible_true = T.Trait(True, BoolHandler())
 flexible_false = T.Trait(False, BoolHandler())

Modified: branches/transforms/lib/matplotlib/contour.py
===================================================================
--- branches/transforms/lib/matplotlib/contour.py       2007-10-05 19:25:33 UTC 
(rev 3924)
+++ branches/transforms/lib/matplotlib/contour.py       2007-10-05 19:37:18 UTC 
(rev 3925)
@@ -397,12 +397,7 @@
         cmap = kwargs.get('cmap', None)
         self.colors = kwargs.get('colors', None)
         norm = kwargs.get('norm', None)
-        self.clip_ends = kwargs.get('clip_ends', None)      ########
         self.extend = kwargs.get('extend', 'neither')
-        if self.clip_ends is not None:
-            warnings.warn("'clip_ends' has been replaced by 'extend'")
-            self.levels = self.levels[1:-1] # discard specified end levels
-            self.extend = 'both'            # regenerate end levels
         self.antialiased = kwargs.get('antialiased', True)
         self.nchunk = kwargs.get('nchunk', 0)
         self.locator = kwargs.get('locator', None)
@@ -436,10 +431,8 @@
             _mask = None
 
         if self.filled:
-            if self.linewidths is None:
-                self.linewidths = 0.05 # Good default for Postscript.
-            if cbook.iterable(self.linewidths):
-                self.linewidths = self.linewidths[0]
+            if self.linewidths is not None:
+                warnings.warn('linewidths is ignored by contourf')
             C = _cntr.Cntr(x, y, z.filled(), _mask)
             lowers = self._levels[:-1]
             uppers = self._levels[1:]
@@ -447,7 +440,6 @@
                 nlist = C.trace(level, level_upper, points = 0,
                         nchunk = self.nchunk)
                 col = collections.PolyCollection(nlist,
-                                     linewidths = (self.linewidths,),
                                      antialiaseds = (self.antialiased,),
                                      edgecolors= 'None')
                 self.ax.add_collection(col)
@@ -500,16 +492,18 @@
         one contour line, but two filled regions, and therefore
         three levels to provide boundaries for both regions.
         '''
-        zmax = self.zmax
-        zmin = self.zmin
-        zmargin = (zmax - zmin) * 0.001 # so z < (zmax + zmargin)
-        zmax = zmax + zmargin
-        intv = transforms.Interval(transforms.Value(zmin), 
transforms.Value(zmax))
         if self.locator is None:
             self.locator = ticker.MaxNLocator(N+1)
-        self.locator.set_view_interval(intv)
-        self.locator.set_data_interval(intv)
-        lev = self.locator()
+        locator = self.locator
+        zmax = self.zmax
+        zmin = self.zmin
+        locator.set_bounds(zmin, zmax)
+        lev = locator()
+        zmargin = (zmax - zmin) * 0.000001 # so z < (zmax + zmargin)
+        if zmax >= lev[-1]:
+            lev[-1] += zmargin
+        if zmin <= lev[0]:
+            lev[0] -= zmargin
         self._auto = True
         if self.filled:
             return lev
@@ -627,16 +621,16 @@
         self._levels = npy.asarray(self._levels)
         self.vmin = npy.amin(self.levels)  # alternative would be self.layers
         self.vmax = npy.amax(self.levels)
-        if self.extend in ('both', 'min') or self.clip_ends:
+        if self.extend in ('both', 'min'):
             self.vmin = 2 * self.levels[0] - self.levels[1]
-        if self.extend in ('both', 'max') or self.clip_ends:
+        if self.extend in ('both', 'max'):
             self.vmax = 2 * self.levels[-1] - self.levels[-2]
         self.layers = self._levels # contour: a line is a thin layer
         if self.filled:
             self.layers = 0.5 * (self._levels[:-1] + self._levels[1:])
-            if self.extend in ('both', 'min') or self.clip_ends:
+            if self.extend in ('both', 'min'):
                 self.layers[0] = 0.5 * (self.vmin + self._levels[1])
-            if self.extend in ('both', 'max') or self.clip_ends:
+            if self.extend in ('both', 'max'):
                 self.layers[-1] = 0.5 * (self.vmax + self._levels[-2])
 
         return (x, y, z)
@@ -774,7 +768,6 @@
               contour levels if they are not given explicitly via the
               V argument.
 
-            ***** New: *****
             * extend = 'neither', 'both', 'min', 'max'
               Unless this is 'neither' (default), contour levels are
               automatically added to one or both ends of the range so that
@@ -782,8 +775,7 @@
               mapped to the special colormap values which default to
               the ends of the colormap range, but can be set via
               Colormap.set_under() and Colormap.set_over() methods.
-              To replace clip_ends=True and V = [-100, 2, 1, 0, 1, 2, 100],
-              use extend='both' and V = [2, 1, 0, 1, 2].
+
             ****************
 
             contour only:
@@ -799,29 +791,13 @@
                 matplotlibrc is used
 
             contourf only:
-            ***** Obsolete: ****
-            * clip_ends = True
-              If False, the limits for color scaling are set to the
-              minimum and maximum contour levels.
-              True (default) clips the scaling limits.  Example:
-              if the contour boundaries are V = [-100, 2, 1, 0, 1, 2, 100],
-              then the scaling limits will be [-100, 100] if clip_ends
-              is False, and [-3, 3] if clip_ends is True.
-            * linewidths = None or a number; default of 0.05 works for
-              Postscript; a value of about 0.5 seems better for Agg.
-            * antialiased = True (default) or False; if False, there is
-              no need to increase the linewidths for Agg, but True gives
-              nicer color boundaries.  If antialiased is True and linewidths
-              is too small, then there may be light-colored lines at the
-              color boundaries caused by the antialiasing.
+            * antialiased = True (default) or False
             * nchunk = 0 (default) for no subdivision of the domain;
               specify a positive integer to divide the domain into
               subdomains of roughly nchunk by nchunk points. This may
               never actually be advantageous, so this option may be
               removed.  Chunking introduces artifacts at the chunk
-              boundaries unless antialiased = False, or linewidths is
-              set to a large enough value for the particular renderer and
-              resolution.
+              boundaries unless antialiased = False
         """
 
 

Modified: branches/transforms/lib/matplotlib/texmanager.py
===================================================================
--- branches/transforms/lib/matplotlib/texmanager.py    2007-10-05 19:25:33 UTC 
(rev 3924)
+++ branches/transforms/lib/matplotlib/texmanager.py    2007-10-05 19:37:18 UTC 
(rev 3925)
@@ -110,7 +110,7 @@
 
     _rc_cache = None
     _rc_cache_keys = ('text.latex.preamble', )\
-                     + tuple('font.'+n for n in ('family', ) + font_families)
+                     + tuple(['font.'+n for n in ('family', ) + font_families])
 
     def __init__(self):
 
@@ -125,7 +125,7 @@
 
         fontconfig = [self.font_family]
         for font_family, font_family_attr in \
-            ((ff, ff.replace('-', '_')) for ff in self.font_families):
+            [(ff, ff.replace('-', '_')) for ff in self.font_families]:
             for font in rcParams['font.'+font_family]:
                 if font.lower() in self.font_info:
                     found_font = self.font_info[font.lower()]
@@ -163,7 +163,7 @@
     def get_font_config(self):
         "Reinitializes self if rcParams self depends on have changed."
         if self._rc_cache is None:
-            self._rc_cache = dict((k,None) for k in self._rc_cache_keys)
+            self._rc_cache = dict([(k,None) for k in self._rc_cache_keys])
         changed = [par for par in self._rc_cache_keys if rcParams[par] != \
                    self._rc_cache[par]]
         if changed:

Modified: branches/transforms/lib/matplotlib/ticker.py
===================================================================
--- branches/transforms/lib/matplotlib/ticker.py        2007-10-05 19:25:33 UTC 
(rev 3924)
+++ branches/transforms/lib/matplotlib/ticker.py        2007-10-05 19:37:18 UTC 
(rev 3925)
@@ -370,7 +370,7 @@
             self.format = '$%s$' % self.format
         elif self._useMathText:
             self.format = '$\mathdefault{%s}$' % self.format
-            
+
     def pprint_val(self, x):
         xp = (x-self.offset)/10**self.orderOfMagnitude
         if npy.absolute(xp) < 1e-8: xp = 0


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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to