bar chart with dates on x-axis blows up

Hi All,

I'm trying to plot a bar chart something like:

from pylab import *
from datetime import datetime,timedelta

now =
data1 = [1,2,3]
data2 = [4,5,6]
labels = [now-timedelta(1),now,now+timedelta(1)]



However, this blows up:

Traceback (most recent call last):
   File "matplotlib\", line 1402, in bar
     ret = gca().bar(*args, **kwargs)
   File "matplotlib\", line 3294, in bar
   File "matplotlib\", line 1146, in add_patch
   File "matplotlib\", line 1152, in _update_patch_limits
     xys = self._get_verts_in_data_coords(
   File "matplotlib\", line 362, in get_verts
     right = self.convert_xunits(x + self.width)
TypeError: unsupported operand type(s) for +: 'datetime.datetime' and 'float'

What am I doing wrong?

Also, how do I go about adding a second set of bars? (ie: from data2)?

(Bear in mind that in the real use, there are over 600 days worth of data, so I want to take advantage of the normal tick locators, etc as much as possible...)




Simplistix - Content Management, Zope & Python Consulting