I'm having an unusually hard time with plotting some data on a date axis. All I want to do is plot several data series over a specific 8 week period. It works fine when I plot all the data (that is not specifying a date range) but when I try to use the axis command to put in my limits it puts the scales up nicely but no data points appear and moreover then I reload and run it again it goes into an infinite loop. I've tried it with Matplotlib 0.90.1 and 0.98.1 with the same results.
The plot() method below: class Plotter: """Generate plots of disk trend data """ Marker = ['s','o','^','d','v','p','x','+','h','<','>','1'] Color = ['black','red','blue','green','aqua','fuchsia', 'navy','purple','olive','maroon','gray','teal'] def __init__(self, trenddict): self.trenddict = trenddict self.today = datetime.date.today() self.dates = trenddict.keys() #keys are datetime objects self.dates.sort() #sorted list of datetime objects def extract(self, dirlist): x = [] ys = {} for date in self.dates: x.append(date2num(date)) for dirname in dirlist: value = self.trenddict[date][dirname] try: ys[dirname].append(value) except KeyError: ys[dirname] = [value] return x, ys def plot(self, dirlist, title, scalemax, filename): fig = figure(num=1, figsize=(8,10), frameon=False) ax = fig.add_subplot(111) ax.set_title(title) ax.xaxis.set_major_locator(WeekdayLocator(MONDAY)) ax.xaxis.set_minor_locator(MultipleLocator(1)) ax.yaxis.set_major_locator(MultipleLocator(10)) ax.set_ylabel("GBytes") ax.grid(True) start = date2num(self.today - datetime.timedelta(49)) end = date2num(self.today + datetime.timedelta(7)) #fig.autofmt_xdate() ax.axis([start, end, 0, scalemax]) x, ys = self.extract(dirlist) for i, directory in enumerate(dirlist): plot_date(x, ys[directory], linestyle='-', marker=self.Marker[i], color=self.Color[i], label=directory) tl = ax.get_xticklabels() setp(tl, 'rotation', 45, fontsize=10) legend(loc='lower left', prop=FontProperties(size="smaller")) savefig(filename) show() close() ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users