On Fri, Jun 10, 2011 at 12:50 PM, calmar c. <m...@calmar.ws> wrote:
> On Fri, Jun 10, 2011 at 11:10:02AM -0500, Benjamin Root wrote:
> >
> > Why not just use an array of datetime.timedelta objects?� I believe
> > matplotlib already supports this, does automatic formatting and even
> > allows you to easily modify how the formatting is done.
>
> I was not able to figure out how it would support them
> (datetime.timedelta objects). datetime.datetime objects only as
> far as I saw.
>
>
That's right, I forgot about that. Usually, my data would have a starting
point anyway, and I just use timedeltas after that point.
> So I would have to create some artificial datetime + add the
> timedeltas (seconds) to it and providing that to the plot I guess,
> right?
>
>
You might be able to get away with using a datetime.time object and add
timedeltas. The formatting should be what you would like to see.
> So far the solution to just show i.e. 70sec as 00:01:20 via some
> little function is almost more sympathetic to me (so far at least).
>
>
Whatever works best for you, that's more important. Note that matplotlib
has some special treatment of date, time and datetime objects to do extra
things for you. It might be a bit tricky at first, but it becomes easier to
use later.
Admittedly, these following examples are for dates (and might even need to
be updated...)
http://matplotlib.sourceforge.net/examples/api/date_demo.html
http://matplotlib.sourceforge.net/examples/api/date_index_formatter.html
There are others as well.
Note that probably half that code can probably be removed for v1.0.x. When
I did my graphs a few months ago, I don't recall needing to specify any
formatters. Maybe I should dig up my code and update those examples.
Cheers,
Ben Root
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users