Hi,
This actually did not work for me. Can you show me the full code that you
used to successfully produce the time-format x-axis labels?
Thanks,
James
Sebastian Berg wrote:
>
> 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@...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
View this message in context: http://old.nabble.com/Date-format-the-x-axis-of-a-barh%28%29-plot--tp31420395p31460691.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|