|
From: <jd...@us...> - 2008-06-24 14:37:44
|
Revision: 5656
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5656&view=rev
Author: jdh2358
Date: 2008-06-24 07:37:41 -0700 (Tue, 24 Jun 2008)
Log Message:
-----------
fixed a date autolocator refresh bug
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-06-24 13:56:55 UTC (rev 5655)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-06-24 14:37:41 UTC (rev 5656)
@@ -2058,7 +2058,8 @@
*tz* is the time zone to use in labeling dates. Defaults to rc value.
"""
- if self.ignore_existing_data_limits:
+ xmin, xmax = self.dataLim.intervalx
+ if xmin==0.:
# no data has been added - let's set the default datalim.
# We should probably use a better proxy for the datalim
# have been updated than the ignore setting
@@ -2074,6 +2075,12 @@
locator = mdates.AutoDateLocator(tz)
self.xaxis.set_major_locator(locator)
+ # the autolocator uses the viewlim to pick the right date
+ # locator, but it may not have correct viewlim before an
+ # autoscale. If the viewlim is still zero..1, set it to the
+ # datalim and the autoscaler will update it on request
+ if self.viewLim.intervalx[0]==0.:
+ self.viewLim.intervalx = tuple(self.dataLim.intervalx)
locator.refresh()
formatter = self.xaxis.get_major_formatter()
@@ -2086,7 +2093,8 @@
*tz* is the time zone to use in labeling dates. Defaults to rc value.
"""
- if self.ignore_existing_data_limits:
+ ymin, ymax = self.dataLim.intervaly
+ if ymin==0.:
# no data has been added - let's set the default datalim.
# We should probably use a better proxy for the datalim
# have been updated than the ignore setting
@@ -2103,6 +2111,13 @@
if not isinstance(locator, mdates.DateLocator):
locator = mdates.AutoDateLocator(tz)
self.yaxis.set_major_locator(locator)
+
+ # the autolocator uses the viewlim to pick the right date
+ # locator, but it may not have correct viewlim before an
+ # autoscale. If the viewlim is still zero..1, set it to the
+ # datalim and the autoscaler will update it on request
+ if self.viewLim.intervaly[0]==0.:
+ self.viewLim.intervaly = tuple(self.dataLim.intervaly)
locator.refresh()
formatter = self.xaxis.get_major_formatter()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|