On Tue, Jun 24, 2008 at 6:14 AM, Darren Dale <[EMAIL PROTECTED]> wrote:
> Please, include a brief standalone script that demonstrates the problem when
> reporting problems.
Sorry should have done that, I've attached an example script (and the
according data files) which exhibits the problem on 0.98.1, 0.98.0 has
no problems.
File "./test.py", line 46, in <module>
test_plot = test_axes.plot_date(test_dates, test, 'bo-')
File "/opt/local/lib/python2.5/site-packages/matplotlib/axes.py",
line 3081, in plot_date
self.xaxis_date(tz)
File "/opt/local/lib/python2.5/site-packages/matplotlib/axes.py",
line 2015, in xaxis_date
locator.refresh()
File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
line 540, in refresh
dmin, dmax = self.viewlim_to_dt()
File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
line 436, in viewlim_to_dt
return num2date(vmin, self.tz), num2date(vmax, self.tz)
File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
line 233, in num2date
if not cbook.iterable(x): return _from_ordinalf(x, tz)
File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
line 156, in _from_ordinalf
dt = datetime.datetime.fromordinal(ix)
ValueError: ordinal must be >= 1
What's strange is that if I comment out the plotting of the second
test data set then the plot is produced without error, even though the
reported error (when plotting both data sets) seems to have nothing to
do with the second data set.
Cheers
Adam
#!/usr/bin/env python
# import required system modules
import sys
import math
from datetime import *
# import required matplotlib modules
import matplotlib
# set backend
matplotlib.use('Agg')
# import remaining matplotlib modules
import pylab
from matplotlib import dates
test_dates = []
test = []
for line in file('test1.dat'):
# parse line
date, num = line.strip().split()
# append to lists
test_dates.append(dates.datestr2num(date))
test.append(float(num))
test2_dates = []
test2 = []
for line in file('test2.dat'):
# parse line
date, num = line.strip().split()
# append to lists
test2_dates.append(dates.datestr2num(date))
test2.append(float(num))
# setup plot
fig = pylab.figure()
test_axes = fig.add_subplot(111)
# setup secondary axes
test2_axes = pylab.twinx()
# produce plot
test_plot = test_axes.plot_date(test_dates, test, 'bo-')
test2_plot = test2_axes.plot_date(test2_dates, test2, 'ro-')
# set up axes
test_axes.xaxis.set_major_locator(pylab.DayLocator(range(0, 31, 2)))
test_axes.xaxis.set_minor_locator(pylab.DayLocator(range(0, 31, 1)))
test_axes.xaxis.set_major_formatter(pylab.DateFormatter('%Y/%m/%d'))
# save plot
fig.savefig('test.png')
# exit cleanly
sys.exit(0)
test1.dat
Description: Binary data
test2.dat
Description: Binary data
------------------------------------------------------------------------- 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-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
