Revision: 6872
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6872&view=rev
Author: jrevans
Date: 2009-02-03 22:29:30 +0000 (Tue, 03 Feb 2009)
Log Message:
-----------
Fixed a bug in RRuleLocator that generated invalid datetimes when padding the
axes bounds for large ranges of times or with times that are close to the
boundaries of valid datetimes.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/dates.py
Modified: trunk/matplotlib/lib/matplotlib/dates.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/dates.py 2009-02-03 19:52:02 UTC (rev
6871)
+++ trunk/matplotlib/lib/matplotlib/dates.py 2009-02-03 22:29:30 UTC (rev
6872)
@@ -481,7 +481,20 @@
if dmin>dmax:
dmax, dmin = dmin, dmax
delta = relativedelta(dmax, dmin)
- self.rule.set(dtstart=dmin-delta, until=dmax+delta)
+
+ # We need to cap at the endpoints of valid datetime
+ try:
+ start = dmin - delta
+ except ValueError:
+ start = _from_ordinalf( 1.0 )
+
+ try:
+ stop = dmax + delta
+ except ValueError:
+ # The magic number!
+ stop = _from_ordinalf( 3652059.9999999 )
+
+ self.rule.set(dtstart=start, until=stop)
dates = self.rule.between(dmin, dmax, True)
return date2num(dates)
@@ -518,7 +531,20 @@
dmax, dmin = dmin, dmax
delta = relativedelta(dmax, dmin)
- self.rule.set(dtstart=dmin-delta, until=dmax+delta)
+
+ # We need to cap at the endpoints of valid datetime
+ try:
+ start = dmin - delta
+ except ValueError:
+ start = _from_ordinalf( 1.0 )
+
+ try:
+ stop = dmax + delta
+ except ValueError:
+ # The magic number!
+ stop = _from_ordinalf( 3652059.9999999 )
+
+ self.rule.set(dtstart=start, until=stop)
dmin, dmax = self.datalim_to_dt()
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins