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