>>>>> "Marquardt," == Marquardt, Colin <[EMAIL PROTECTED]> writes:


    Colin> * My data file consists of a date (in ISO format) and
    Colin> integers. Parsing the date was a bit of work. I
    Colin> understand that python's datetime doesn't provide any
    Colin> parsing of dates - but maybe matplotlib should have
    Colin> some functions for that then?  FWIW, here is how
    Colin> gnuplot does this (adapted from
    Colin> http://t16web.lanl.gov/Kawano/gnuplot/datetime-e.html):

    Colin>      set xdata time set timefmt "%Y-%m-%d" set format
    Colin> x "%Y-%m"

gnuplot does handle file plots nicely -- here is an example of how to
parse files with date entries and plot them in matplotlib.  Basically,
the load function takes a dictionary mapping column index to a
converter function which returns a float.

    from pylab import figure, show, datestr2num, load
    dates, closes = load(
        'data/msft.csv', delimiter=',',
        converters={0:datestr2num}, skiprows=1, usecols=(0,2),
        unpack=True)

    fig = figure()
    ax = fig.add_subplot(111)
    ax.plot_date(dates, closes)
    show()


The function datestr2num takes any date string recognized by
dateutils.parse (most of them) and returns a floating point number
days since 0000-00-00 which is how matplotlib represents dates.

    Colin> * gnuplot has a plot style "steps"
    Colin> (http://t16web.lanl.gov/Kawano/gnuplot/intro/style-e.html)
    Colin> - I could only fake that with with extra "dummy"
    Colin> points in matplotlib as I understand it. It would be
    Colin> nice if matplotlib could do this for me.

We have steps too!

  plot(x, y, linestyle='steps')


Hope this helps,
JDH


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to