Hmm, looks like I was just missing a third argument '-' from the
plot_date function.

Thanks, Tom

-------- Forwarded Message --------
From: Tom Haddon <[EMAIL PROTECTED]>
To: John Hunter <[EMAIL PROTECTED]>
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] Irregular Dates
Date: Thu, 19 Jul 2007 13:39:58 -0700

On Wed, 2007-07-18 at 20:02 -0500, John Hunter wrote:
> On 7/18/07, Tom Haddon <[EMAIL PROTECTED]> wrote:
> > I think you mean it makes no assumption about the intervals between my
> > dates? If so, I must be missing something. How am I supposed to pass the
> > data to the plot_date function? If I pass it in as integers from epoch I
> > get an error saying "year is out of range". If I pass it in as datetime
> > objects I get an error saying "TypeError: float is required".
> > m +1.415.871.4180
> > www.greenleaftech.net
> 
> Use the function matplotlib.dates.epoch2num to convert your epoch data
> into the mpl date format.  That or use "plot" with native python
> datetime obects in the latest mpl release.

John,

Thanks for the help so far. Think I'm making progress. However, I now
have a graph that's solid blue (the default line color, I guess). No
line, just solid blue.

Here's the data:

dates = [732748.962546, 732748.898183, 732748.846273, 732748.793252,
732748.569873, 732748.351782, 732748.296273, 732748.24015,
732748.046238, 732747.990046, 732747.484074, 732747.428762,
732746.858449, 732746.171238, 732745.759757, 732744.970671,
732744.879271, 732744.759259, 732744.344653, 732744.282025,
732744.169954, 732744.101169, 732744.047153, 732743.997037,
732743.412755, 732743.274005, 732743.124907, 732743.074074,
732743.019931, 732742.921481, 732742.870613, 732742.611551,
732742.300451, 732742.249977, 732741.995475, 732741.687882,
732741.425336, 732741.361088, 732741.117581, 732740.613704,
732739.330208, 732738.073218, 732738.013472, 732737.963576,
732737.912951, 732737.587951, 732737.522905, 732737.46213,
732737.405926, 732737.072662, 732736.909317, 732736.861215,
732736.810127, 732736.702442, 732736.411354, 732736.291123]
durations = [66.966666666666669, 68.233333333333334, 64.36666666666666,
67.61666666666666, 72.016666666666666, 71.083333333333329,
65.200000000000003, 72.25, 64.900000000000006, 72.349999999999994,
73.233333333333334, 68.950000000000003, 72.316666666666663,
62.966666666666669, 69.549999999999997, 71.316666666666663,
63.983333333333334, 68.166666666666671, 69.266666666666666,
65.933333333333337, 67.433333333333337, 71.700000000000003,
68.86666666666666, 62.81666666666667, 63.266666666666666,
68.950000000000003, 67.099999999999994, 64.0, 69.233333333333334,
69.783333333333331, 64.033333333333331, 64.316666666666663, 63.75,
63.43333333333333, 63.5, 63.233333333333334, 63.383333333333333,
67.816666666666663, 63.100000000000001, 63.916666666666664,
67.783333333333331, 61.483333333333334, 64.049999999999997,
62.733333333333334, 64.166666666666671, 62.583333333333336,
66.61666666666666, 63.100000000000001, 67.299999999999997,
64.183333333333337, 63.200000000000003, 60.366666666666667, 63.25,
63.200000000000003, 64.38333333333334, 62.5]

And here's the code:

    matplotlib.use('Cairo')
    fig = Figure()
    canvas = FigureCanvas(fig)
    ax = fig.add_subplot(111)
    ax.plot_date(dates, durations)
    ax.set_title('Title')
    ax.grid(True)
    ax.set_xlabel('Date')
    ax.set_ylabel('Duration in Minutes')
    canvas.draw()
    imdata=StringIO()
    fig.savefig(imdata,format='png')
    return HttpResponse(imdata.getvalue(), mimetype='image/png')

Any ideas what I'm missing?

Thanks, Tom

> 
> JDH
-- 


----------------------------------
Tom Haddon
mailto:[EMAIL PROTECTED]
m +1.415.871.4180
www.greenleaftech.net


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to