SF.net SVN: matplotlib:[8478] trunk/matplotlib/lib/matplotlib/backend_bases .py

2010-06-30 Thread ryanmay
Revision: 8478
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8478&view=rev
Author:   ryanmay
Date: 2010-06-30 16:31:23 + (Wed, 30 Jun 2010)

Log Message:
---
Force timer interval to int. This silences an exception for Tk and a warning 
from GTK when a float is given.

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/backend_bases.py

Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===
--- trunk/matplotlib/lib/matplotlib/backend_bases.py2010-06-29 21:44:19 UTC 
(rev 8477)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py2010-06-30 16:31:23 UTC 
(rev 8478)
@@ -944,6 +944,9 @@
 return self._interval
 
 def _set_interval(self, interval):
+# Force to int since none of the backends actually support fractional
+# milliseconds, and some error or give warnings.
+interval = int(interval)
 self._interval = interval
 self._timer_set_interval()
 


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 Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[8479] trunk/matplotlib

2010-06-30 Thread efiring
Revision: 8479
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8479&view=rev
Author:   efiring
Date: 2010-06-30 21:07:36 + (Wed, 30 Jun 2010)

Log Message:
---
set_xlim, set_ylim: turn off autoscaling; added autoscale method

Modified Paths:
--
trunk/matplotlib/boilerplate.py
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/blocking_input.py
trunk/matplotlib/lib/matplotlib/image.py
trunk/matplotlib/lib/matplotlib/projections/polar.py
trunk/matplotlib/lib/matplotlib/pylab.py
trunk/matplotlib/lib/matplotlib/pyplot.py
trunk/matplotlib/lib/matplotlib/tests/test_dates.py
trunk/matplotlib/lib/matplotlib/widgets.py
trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py

Modified: trunk/matplotlib/boilerplate.py
===
--- trunk/matplotlib/boilerplate.py 2010-06-30 16:31:23 UTC (rev 8478)
+++ trunk/matplotlib/boilerplate.py 2010-06-30 21:07:36 UTC (rev 8479)
@@ -109,6 +109,7 @@
 'locator_params',
 'tick_params',
 'margins',
+'autoscale',
 )
 
 cmappable = {

Modified: trunk/matplotlib/lib/matplotlib/axes.py
===
--- trunk/matplotlib/lib/matplotlib/axes.py 2010-06-30 16:31:23 UTC (rev 
8478)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2010-06-30 21:07:36 UTC (rev 
8479)
@@ -1715,7 +1715,46 @@
 """
 return self._rasterization_zorder
 
+def autoscale(self, enable=True, axis='both', tight=None):
+"""
+Convenience method for simple axis view autoscaling.
+It turns autoscaling on or off, and then,
+if autoscaling for either axis is on, it performs
+the autoscaling on the specified axis or axes.
 
+*enable*: [True | False | None]
+True (default) turns autoscaling on, False turns it off.
+None leaves the autoscaling state unchanged.
+
+*axis*: ['x' | 'y' | 'both']
+which axis to operate on; default is 'both'
+
+*tight*: [True | False | None]
+If True, set view limits to data limits;
+if False, let the locator and margins expand the view limits;
+if None, use tight scaling if the only artist is an image,
+otherwise treat *tight* as False.
+The *tight* setting is retained for future autoscaling
+until it is explicitly changed.
+
+
+Returns None.
+"""
+if enable is None:
+scalex = True
+scaley = True
+else:
+scalex = False
+scaley = False
+if axis in ['x', 'both']:
+self._autoscaleXon = bool(enable)
+scalex = self._autoscaleXon
+if axis in ['y', 'both']:
+self._autoscaleYon = bool(enable)
+scaley = self._autoscaleYon
+self.autoscale_view(tight=tight, scalex=scalex, scaley=scaley)
+
+
 def autoscale_view(self, tight=None, scalex=True, scaley=True):
 """
 autoscale the view limits using the data limits. You can
@@ -2209,7 +2248,7 @@
 def invert_xaxis(self):
 "Invert the x-axis."
 left, right = self.get_xlim()
-self.set_xlim(right, left)
+self.viewLim.intervalx = (right, left)
 
 def xaxis_inverted(self):
 'Returns True if the x-axis is inverted.'
@@ -2233,6 +2272,7 @@
 """
 Set the lower and upper numerical bounds of the x-axis.
 This method will honor axes inversion regardless of parameter order.
+It will not change the _autoscaleXon attribute.
 """
 if upper is None and iterable(lower):
 lower,upper = lower
@@ -2244,14 +2284,14 @@
 
 if self.xaxis_inverted():
 if lower < upper:
-self.set_xlim(upper, lower)
+self.set_xlim(upper, lower, auto=None)
 else:
-self.set_xlim(lower, upper)
+self.set_xlim(lower, upper, auto=None)
 else:
 if lower < upper:
-self.set_xlim(lower, upper)
+self.set_xlim(lower, upper, auto=None)
 else:
-self.set_xlim(upper, lower)
+self.set_xlim(upper, lower, auto=None)
 
 def get_xlim(self):
 """
@@ -2259,32 +2299,45 @@
 """
 return tuple(self.viewLim.intervalx)
 
-def set_xlim(self, xmin=None, xmax=None, emit=True, **kwargs):
+def set_xlim(self, xmin=None, xmax=None, emit=True, auto=False):
 """
 call signature::
 
-  set_xlim(self, *args, **kwargs)
+  set_xlim(self, *args, **kwargs):
 
-Set the limits for the xaxis
+Set the data limits for the xaxis
 
-Returns the current xlimits as a length 2 tuple: [*xmin*, *xmax*]
-
 Examples::
 
-  set_xlim((valmin, valmax))
- 

SF.net SVN: matplotlib:[8480] trunk/matplotlib

2010-06-30 Thread efiring
Revision: 8480
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8480&view=rev
Author:   efiring
Date: 2010-06-30 21:14:31 + (Wed, 30 Jun 2010)

Log Message:
---
doc changes for last commit

Modified Paths:
--
trunk/matplotlib/CHANGELOG
trunk/matplotlib/doc/api/api_changes.rst

Modified: trunk/matplotlib/CHANGELOG
===
--- trunk/matplotlib/CHANGELOG  2010-06-30 21:07:36 UTC (rev 8479)
+++ trunk/matplotlib/CHANGELOG  2010-06-30 21:14:31 UTC (rev 8480)
@@ -1,3 +1,11 @@
+2010-06-30 Added autoscale convenience method and corresponding
+   pyplot function for simplified control of autoscaling;
+   and changed axis, set_xlim, and set_ylim so that by
+   default, they turn off the autoscaling on the relevent
+   axis or axes.  Therefore one can call set_xlim before
+   plotting a line, for example, and the limits will be
+   retained. - EF
+
 2010-06-20 Added Axes.tick_params and corresponding pyplot function
to control tick and tick label appearance after an Axes
has been created. - EF

Modified: trunk/matplotlib/doc/api/api_changes.rst
===
--- trunk/matplotlib/doc/api/api_changes.rst2010-06-30 21:07:36 UTC (rev 
8479)
+++ trunk/matplotlib/doc/api/api_changes.rst2010-06-30 21:14:31 UTC (rev 
8480)
@@ -10,11 +10,22 @@
 Changes beyond 0.99.x
 =
 
-* There are four new Axes methods with corresponding pyplot
+* The default behavior of :meth:`matplotlib.axes.Axes.set_xlim`,
+  :meth:`matplotlib.axes.Axes.set_ylim`, and
+  :meth:`matplotlib.axes.Axes.axis`, and their corresponding
+  pyplot functions, has been changed: when view limits are
+  set explicitly with one of these methods, autoscaling is turned
+  off for the matching axis. A new *auto* kwarg is available to
+  control this behavior.
+
+* There are five new Axes methods with corresponding pyplot
   functions to facilitate autoscaling, tick location, and tick
   label formatting, and the general appearance of ticks and
   tick labels:
 
+  + :meth:`matplotlib.axes.Axes.autoscale` turns autoscaling
+on or off, and applies it.
+
   + :meth:`matplotlib.axes.Axes.margins` sets margins used to
 autoscale the :attr:`matplotlib.axes.Axes.viewLim` based on
 the :attr:`matplotlib.axes.Axes.dataLim`.


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 Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins