Revision: 5384
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5384&view=rev
Author: jdh2358
Date: 2008-06-04 11:15:05 -0700 (Wed, 04 Jun 2008)
Log Message:
-----------
Merged revisions 5383 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint
........
r5383 | jdh2358 | 2008-06-04 12:49:17 -0500 (Wed, 04 Jun 2008) | 1 line
try to handle xaxis_date more gracefully when no data has been added
........
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-5381
+ /branches/v0_91_maint:1-5383
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-06-04 17:49:17 UTC (rev
5383)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-06-04 18:15:05 UTC (rev
5384)
@@ -1,5 +1,5 @@
from __future__ import division, generators
-import math, warnings, new
+import math, sys, warnings, datetime, new
import numpy as np
from numpy import ma
@@ -1309,6 +1309,8 @@
# limits and set the bound to be the bounds of the xydata.
# Otherwise, it will compute the bounds of it's current data
# and the data in xydata
+
+ if iterable(xys) and not len(xys): return
if not ma.isMaskedArray(xys):
xys = np.asarray(xys)
self.dataLim.update_from_data_xy(xys, self.ignore_existing_data_limits)
@@ -1320,6 +1322,7 @@
# limits and set the bound to be the bounds of the xydata.
# Otherwise, it will compute the bounds of it's current data
# and the data in xydata
+ if iterable(x) and not len(x): return
self.dataLim.update_from_data(x, y, self.ignore_existing_data_limits)
self.ignore_existing_data_limits = False
@@ -1985,11 +1988,24 @@
tz is the time zone to use in labeling dates. Defaults to rc value.
"""
+ if self.ignore_existing_data_limits:
+ # 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
+ dmax = today = datetime.date.today()
+ dmin = today-datetime.timedelta(days=10)
+ self._process_unit_info(xdata=(dmin, dmax))
+ dmin, dmax = self.convert_xunits([dmin, dmax])
+ self.viewLim.intervalx = dmin, dmax
+ self.dataLim.intervalx = dmin, dmax
+
locator = self.xaxis.get_major_locator()
if not isinstance(locator, mdates.DateLocator):
locator = mdates.AutoDateLocator(tz)
self.xaxis.set_major_locator(locator)
+ locator.refresh()
+
formatter = self.xaxis.get_major_formatter()
if not isinstance(formatter, mdates.DateFormatter):
formatter = mdates.AutoDateFormatter(locator)
@@ -2000,11 +2016,24 @@
tz is the time zone to use in labeling dates. Defaults to rc value.
"""
+ if self.ignore_existing_data_limits:
+ # 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
+ dmax = today = datetime.date.today()
+ dmin = today-datetime.timedelta(days=10)
+ self._process_unit_info(ydata=(dmin, dmax))
+ dmin, dmax = self.convert_yunits([dmin, dmax])
+ self.viewLim.intervaly = dmin, dmax
+ self.dataLim.intervaly = dmin, dmax
+
+
locator = self.yaxis.get_major_locator()
if not isinstance(locator, mdates.DateLocator):
locator = mdates.AutoDateLocator(tz)
self.yaxis.set_major_locator(locator)
+ locator.refresh()
formatter = self.xaxis.get_major_formatter()
if not isinstance(formatter, mdates.DateFormatter):
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins