Hi,
[cross posted to egenix and matplotlib]
I have been using the egenix mxDateTime module and want to plot some of
the dates with Matplotlib (pylab). Pylab uses num2date and date2num to
covert datesandtimes to floating point values for plotting.
Unfortunately if you give pylab date2num an egenix DateTime object,
pylab bombs. Is there a simple way to use egenix DateTime objects with
Pylab?
Below is a simple example
#D:\apps\Python23\python.exe
from datetime import *
from mx.DateTime import *
from pylab import *
# This works
a=datetime(2005,10,10,5,5,5)
print a
# This works
b=DateTime(2005,10,10,5,5,5)
print b
# This works
c=date2num(a)
print c
# This fails
d=date2num(b)
print d
The output and failure message is:
2005-10-10 05:05:05
2005-10-10 05:05:05.00
732229.211863
Traceback (most recent call last):
File "datetime-problem.py", line 20, in ?
d=date2num(b)
File "D:\apps\Python23\lib\site-packages\matplotlib\dates.py", line
174, in da
te2num
if not iterable(d): return _to_ordinalf(d)
File "D:\apps\Python23\lib\site-packages\matplotlib\dates.py", line
137, in _t
o_ordinalf
base = dt.toordinal()
AttributeError: toordinal
thanks, Simon
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users