From: Shailesh K. <ko...@me...> - 2008-11-21 03:52:11
|
Hello, I am trying to fill the space below a curve where my x-axis is indexed by time. The matplotlib api documentation and the examples don't touch on this subject and I haven't had much luck trying a few different variations. Here's what I've tried so far, maybe someone can point out what I'm doing wrong. import time import matplotlib.pyplot as plt import matplotlib.mlab as mlab time_strings = [ list of times as strings ] xs = [ date2num(time.strptime(string) for string in time_strings ] ys = [ list of float values ] fig = plt.figure() ax = fig.add_subplot(111) ax.plot_date(xs, ys) xv, yv = mlab.poly_below(0, xs, ys) ax.fill(xv, yv) When I do this, I get a 'year out of range' error. If I try and fill the area before the call to ax.plot_date, The fill looks like a solid bar about the height of the max y-value. From, looking at the posts on the mailing list it doesn't seem that I'm doing something terribly wrong, maybe I'm missing something subtle? Thanks, - Shailesh |