Hello,

don't know the foo behind it, but using
ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d %H:%M:%S'))
works.

Regards,

Sebastian

On Sun, 2011-04-17 at 19:52 -0700, jfortiv wrote:

> Hello, 
> 
> I'm trying to create a bar chart that looks something like a gannt chart...
> 
> See the simple example here:
> 
> http://www.promana.net/making-use-of-gantt-charts/
> 
> I'm trying to utilize barh() and fmt_xdata to accomplish this with the
> following:
> 
> #~~~~~~~~~~~~~~~~~~~~~~~
> 
> date1 = datetime.datetime( 2000, 3, 2)
> date2 = datetime.datetime( 2000, 3, 6)
> delta = datetime.timedelta(hours=6)
> dates = mdates.drange(date1, date2, delta)
> 
> val = mdates.drange(date1,date2,delta)   # the bar lengths
> pos = range(len(val))    # the bar centers on the y axis
> height=0.5        # the bar height
> left=mdates.drange(date1,date2,delta)        # the bar starting position
> 
> fig = plt.figure()
> ax = fig.add_subplot(111)
> ax.barh(pos,val,height=height,left=left,align='center',alpha=0.3)
> ax.fmt_xdata = mdates.DateFormatter('%Y-%m-%d %H:%M:%S')
> 
> #~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
> Even with ax.fmt_xdata, I'm simply getting numbers on the x-axis instead of
> dates.  Can anyone offer some pointers?
> 
> Thanks,
> James


------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to