SF.net SVN: matplotlib: [3932] branches/transforms

2007-10-10 Thread mdboom
Revision: 3932
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3932&view=rev
Author:   mdboom
Date: 2007-10-10 06:37:28 -0700 (Wed, 10 Oct 2007)

Log Message:
---
Lots more work on making examples work.  Details, details, details...

Modified Paths:
--
branches/transforms/lib/matplotlib/axes.py
branches/transforms/lib/matplotlib/axis.py
branches/transforms/lib/matplotlib/backend_bases.py
branches/transforms/lib/matplotlib/backends/backend_agg.py
branches/transforms/lib/matplotlib/cbook.py
branches/transforms/lib/matplotlib/collections.py
branches/transforms/lib/matplotlib/colorbar.py
branches/transforms/lib/matplotlib/dates.py
branches/transforms/lib/matplotlib/figure.py
branches/transforms/lib/matplotlib/lines.py
branches/transforms/lib/matplotlib/scale.py
branches/transforms/lib/matplotlib/text.py
branches/transforms/lib/matplotlib/ticker.py
branches/transforms/lib/matplotlib/transforms.py
branches/transforms/src/_backend_agg.cpp

Modified: branches/transforms/lib/matplotlib/axes.py
===
--- branches/transforms/lib/matplotlib/axes.py  2007-10-09 15:58:36 UTC (rev 
3931)
+++ branches/transforms/lib/matplotlib/axes.py  2007-10-10 13:37:28 UTC (rev 
3932)
@@ -477,7 +477,11 @@
 
 """ % {'scale': ' | '.join([repr(x) for x in 
mscale.get_scale_names()])}
 martist.Artist.__init__(self)
-self._position = mtransforms.Bbox.from_lbwh(*rect)
+if isinstance(rect, mtransforms.Bbox):
+self._position = rect
+else:
+warnings.warn("Passing non-bbox as rect to Axes")
+mtransforms.Bbox.from_lbwh(*rect)
 self._originalPosition = self._position.frozen()
 self.set_axes(self)
 self.set_aspect('auto')
@@ -564,16 +568,16 @@
 # It is assumed that this part will have non-linear components
 self.transScale = 
mtransforms.TransformWrapper(mtransforms.IdentityTransform())
 
-# A (possibly non-linear) projection on the (already scaled) data
-self.transProjection = mtransforms.IdentityTransform()
-
 # An affine transformation on the data, generally to limit the
 # range of the axes
 self.transLimits = mtransforms.BboxTransform(
 mtransforms.TransformedBbox(self.viewLim, self.transScale), 
mtransforms.Bbox.unit())
-
-self.transData = self.transScale + self.transProjection + 
self.transLimits + self.transAxes
 
+# The parentheses are important for efficiency here -- they
+# group the last two (which are usually affines) separately
+# from the first (which, with log-scaling can be non-affine).
+self.transData = self.transScale + (self.transLimits + self.transAxes)
+
 self._xaxis_transform = mtransforms.blended_transform_factory(
 self.axes.transData, self.axes.transAxes)
 self._yaxis_transform = mtransforms.blended_transform_factory(
@@ -807,9 +811,9 @@
 ', '.join(mtransforms.BBox.coefs.keys()))
 
 def get_data_ratio(self):
-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)
 return ysize/xsize
 
@@ -819,7 +823,7 @@
 axes box or the view limits.
 '''
 #MGDTODO: Numpify
-
+
 if self._aspect == 'auto':
 self.set_position( self._originalPosition , 'active')
 return
@@ -843,7 +847,6 @@
 self.set_position(pb1.anchored(self._anchor, pb), 'active')
 return
 
-
 xmin,xmax = self.get_xbound()
 xsize = max(math.fabs(xmax-xmin), 1e-30)
 ymin,ymax = self.get_ybound()
@@ -1519,7 +1522,9 @@
 if xmin is None: xmin = old_xmin
 if xmax is None: xmax = old_xmax
 
-xmax, xmin = mtransforms.nonsingular(xmax, xmin, increasing=False)
+xmin, xmax = mtransforms.nonsingular(xmin, xmax)
+xmin, xmax = self.xaxis.limit_range_for_scale(xmin, xmax)
+
 self.viewLim.intervalx = (xmin, xmax)
 
 if emit:
@@ -1678,6 +1683,7 @@
 if ymax is None: ymax = old_ymax
 
 ymin, ymax = mtransforms.nonsingular(ymin, ymax, increasing=False)
+ymin, ymax = self.yaxis.limit_range_for_scale(ymin, ymax)
 self.viewLim.intervaly = (ymin, ymax)
 
 if emit:
@@ -1884,10 +1890,12 @@
 .transformed(p.trans_inverse)
 elif button == 3:
 try:
-# MGDTODO: This is broken with log scales
-dx, dy = format_deltas(key, dx, dy)
 dx = -dx / float(self.bbox.width)
 dy = -dy / float(self.bbox.height)
+dx, dy = format_deltas(key, dx, dy

SF.net SVN: matplotlib: [3933] branches/transforms

2007-10-10 Thread mdboom
Revision: 3933
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3933&view=rev
Author:   mdboom
Date: 2007-10-10 06:38:32 -0700 (Wed, 10 Oct 2007)

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


  r3930 | mdboom | 2007-10-09 11:58:09 -0400 (Tue, 09 Oct 2007) | 2 lines
  
  Fix bug saving PNG files in GtkAgg backend.

  r3931 | mdboom | 2007-10-09 11:58:36 -0400 (Tue, 09 Oct 2007) | 3 lines
  
  Raw files should be saved (optionally) with rgba extension, which is
  what ImageMagick understands.


Modified Paths:
--
branches/transforms/lib/matplotlib/backend_bases.py
branches/transforms/lib/matplotlib/backends/backend_gtkagg.py

Property Changed:

branches/transforms/


Property changes on: branches/transforms
___
Name: svnmerge-integrated
   - /trunk/matplotlib:1-3928
   + /trunk/matplotlib:1-3932

Modified: branches/transforms/lib/matplotlib/backend_bases.py
===
--- branches/transforms/lib/matplotlib/backend_bases.py 2007-10-10 13:37:28 UTC 
(rev 3932)
+++ branches/transforms/lib/matplotlib/backend_bases.py 2007-10-10 13:38:32 UTC 
(rev 3933)
@@ -1083,7 +1083,7 @@
 'png': 'Portable Network Graphics',
 'ps' : 'Postscript',
 'raw': 'Raw RGBA bitmap',
-'rgb': 'Raw RGBA bitmap',
+'rgba': 'Raw RGBA bitmap',
 'svg': 'Scalable Vector Graphics',
 'svgz': 'Scalable Vector Graphics'
 }

Modified: branches/transforms/lib/matplotlib/backends/backend_gtkagg.py
===
--- branches/transforms/lib/matplotlib/backends/backend_gtkagg.py   
2007-10-10 13:37:28 UTC (rev 3932)
+++ branches/transforms/lib/matplotlib/backends/backend_gtkagg.py   
2007-10-10 13:38:32 UTC (rev 3933)
@@ -98,7 +98,9 @@
 if DEBUG: print 'FigureCanvasGTKAgg.done'
 
 def print_png(self, filename, *args, **kwargs):
-return FigureCanvasAgg.print_png(self, filename, *args, **kwargs)
+# Do this so we can save the resolution of figure in the PNG file
+agg = self.switch_backends(FigureCanvasAgg)
+return agg.print_png(filename, *args, **kwargs)
 
 """\
 Traceback (most recent call last):


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