[Matplotlib-users] Plotting Dates on the Y Axis?
Is it possible to plot dates on the y axis? Regards, Kenneth Miller - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Plotting dates on the Y axis?
All, Is it possible to plot dates on the Y-axis? I'd like to have dates on the y axis descending or ascending versus my values on the x - axis. Is it possible to do this or simply switch the axis? Thanks! Regards, Ken - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting dates on the Y axis?
Kenneth Miller wrote: Is it possible to plot dates on the Y-axis? I'd like to have dates on the y axis descending or ascending versus my values on the x - axis. Is it possible to do this or simply switch the axis? Not sure what you mean, have you just tried it with plot or plot_dates? What problems are you experiencing? cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting dates on the Y axis?
On Fri, Mar 21, 2008 at 11:27 AM, Kenneth Miller [EMAIL PROTECTED] wrote: All, Is it possible to plot dates on the Y-axis? I'd like to have dates on the y axis descending or ascending versus my values on the x - axis. Is it possible to do this or simply switch the axis? Not a problem -- with recent versions of mpl, you can simply pass a sequence of date objects directly. Use Axes.invert_yaxis to change the order from ascending to descending. Here is an example loading some data from a CSV file and plotting floats on the x axis and dates on the y axis In [7]: import matplotlib.mlab as mlab In [8]: r = mlab.csv2rec('aapl.csv') In [9]: r.sort() In [10]: r[-5:] Out[10]: recarray([ (datetime.date(2008, 2, 11), 128.00, 129.97, 127.2, 129.44, 42886900, 129.44), (datetime.date(2008, 2, 12), 130.69, 131.0, 123.62, 124.86, 43749900, 124.86), (datetime.date(2008, 2, 13), 126.680001, 129.78, 125.63, 129.41, 34542300, 129.41), (datetime.date(2008, 2, 14), 129.41, 130.81, 127.010001, 127.45, 34074900, 127.45), (datetime.date(2008, 2, 15), 126.27, 127.08, 124.06, 124.63, 32163400, 124.63)], dtype=[('date', '|O4'), ('open', 'f8'), ('high', 'f8'), ('low', 'f8'), ('close', 'f8'), ('volume', 'i4'), ('adj_close', 'f8')]) In [11]: fig = figure() In [12]: ax = fig.add_subplot(111) In [13]: ax.plot(r.close, r.date, 'o') Out[13]: [matplotlib.lines.Line2D instance at 0x237fc10] In [14]: draw() In [15]: ax.invert_yaxis() In [16]: draw() - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting dates on the Y axis?
On Mar 21, 2008, at 11:56 AM, Chris Withers wrote: Kenneth Miller wrote: Is it possible to plot dates on the Y-axis? I'd like to have dates on the y axis descending or ascending versus my values on the x - axis. Is it possible to do this or simply switch the axis? Not sure what you mean, have you just tried it with plot or plot_dates? A common type of graph in my work is to see the value (from 0 to something) represented on the x axis, and instead of the y representing a value, it represents time. The closer the Y value gets to the x-axis, the closer it is to the current time, and the further away the further back in time. When i pass plot_dates timestamps for the y axis, and integers for the x axis it simply displays the y-axis as floats. Regards, Kenneth Miller What problems are you experiencing? cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting dates on the Y axis?
Kenneth Miller wrote: back in time. When i pass plot_dates timestamps for the y axis, and integers for the x axis it simply displays the y-axis as floats. did you try: plot_dates(x,dates,ydate=True) ? Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users