From: John H. <jdh...@ac...> - 2004-08-31 04:19:02
|
>>>>> "GHubert" == Hubert Hickman <hu...@tc...> writes: GHubert> Hello, I am trying to construct a plot that is a barchart GHubert> with the X-axis being dates. I have used the plot_dates GHubert> to generated line plots that look great, however, other GHubert> than turning the dates into integers myself I cannot GHubert> figure out a way to do a barchart with dates as the GHubert> Xaxis. GHubert> Has anyone done one of these - I am using the wxPython GHubert> backend, if that matters. I suggest you use integer (epoch) dates on the x axis of the bar as provided by a datetime converter (see http://matplotlib.sourceforge.net/matplotlib.dates.html) and then use one of the many matplotlib datetime tick locators and formatters which know how to format these epoch dates. With any axes, you can set a custom tick locator and/or formatter. This is, in fact, what plot_date does; see also http://matplotlib.sourceforge.net/matplotlib.ticker.html and see the examples (from http//matplotlib.sf.net/examples or in the matplotlib src distribution in the examples subdir) custom_ticker1.py major_minor_demo1.py and major_minor_demo2.py and take a look at the src code of the plot_date function in matplotlib/axes.py for an example of using date tickers and formatters. Sorry I can't be of more help right now but I'm short on time; perhaps someone else can provide a concrete example. Cheers, JDH |