From: Deen Sethanandha <khundeen@gm...>  20070826 03:36:46

Could someone help me figure out how I can move the x lebel to match the bar chart? Thanks, Deen On 8/19/07, Deen Sethanandha <khundeen@...> wrote: > Hi, > > I am trying to plot a graph as shown. > http://trachacks.org/attachment/wiki/TracMetrixDashboard/cummulative.PNG > > I am not sure why the label start at the point 1 instead of point 0. Here > is the code that is used to generate the graph. > > > > matplotlib.use(*'Agg'*) > > fig = figure() > > ax = fig.add_subplot(111) # Create supplot with key 111 > > ax.cla() > > ax.plot(numdates, tkt_cummulative_table[*'Enter'*], *'b'*) > > ax.plot(numdates, tkt_cummulative_table[*'Leave'*], *'r'*) > > ax.plot(numdates, tkt_cummulative_table[*'Finish'*], *'g'*) > > ax.set_xlim( numdates[0], numdates[1] ) > > ax.xaxis.set_major_locator(DayLocator()) > > ax.xaxis.set_major_formatter( DateFormatter(*'%Y%m%d'*)) > > ax.fmt_xdata = DateFormatter(*'%Y%m%d %H:%M:%S'*) > > labels = ax.get_xticklabels() > > setp(labels, rotation=45, fontsize=8) > > xlabel(*'Dates (day)'*) > > ylabel(*'Counts (times)'*) > > title(*'Cummulative flow chart for ticket status history'*) > > legend((*'Ticket Entered'*, *'Ticket Left'*, *'Ticket Completed'*), > loc=*'upper > left'*) > > numdate is the array of date generated from drange function. I am pretty > new to matplotlib. I create these code from looking at the examples. I > might have done something wrong. If you could put it out for me, it would > be very appreciated. > > I am also wonder why we need ax.set_xlim( numdates[0], numdates[1]. > However, > if I don't use it. There graph will include a few days that aren't in the > numdates in the graph. > > Thanks, > > Deen > 