plot bars with date axis

Hi, to plot against dates, I use 'plot_date'. to plot

    > bars, I use 'bar'. How do I plot with bars against dates?

The key point is that all date plotting is converting your dates to
matplotlib datenums -- see num2date and date2num, and then setting the
tick locators and formatters properly so that they do the right thing.

To learn about tick locators and formatters see
http://matplotlib.sf.net/matplotlib.ticker.html and in a date specific
contect http://matplotlib.sf.net/matplotlib.dates.html .

Once you have digested that, take a look at the plot_date
implementation in axes.py. Basically all it does is try to make an
intelligent guess about which locator and formatter to use, and then
forwards to data to "plot".

So all you have to do is make the intelligent choice about locator and
formatters yourself, and send the date2num data directly to bar.

(nice signature, btw)

JDH

John Hunter schreef:

    > Hi, to plot against dates, I use 'plot_date'. to plot
    > bars, I use 'bar'. How do I plot with bars against dates?

The key point is that all date plotting is converting your dates to
matplotlib datenums -- see num2date and date2num, and then setting the
tick locators and formatters properly so that they do the right thing.

To learn about tick locators and formatters see
http://matplotlib.sf.net/matplotlib.ticker.html and in a date specific
contect http://matplotlib.sf.net/matplotlib.dates.html .

Ah, thank you! I've worked it out now. In case anyone's curious:

code at http://topjaklont.student.utwente.nl/creaties/plothttplog.py
result at http://topjaklont.student.utwente.nl/eigenstats/bezoekers7x6.png
(updated nightly)

yours,
Gerrit.

P.S.
I've studies the .py sources at various places and saw a few places where
I though "this could be better" (for example, __future__ placed before
docstring doesn't work for docstring). I wanted to send a patch to SF but
SF's anonymous CVS is partially down so I couldn't do a cvs up. Is
Sourceforge patches page the correct place to send patches if I want to?

···

--
Weather in Lulea / Kallax, Sweden 10/02 16:20:
  -1.0°C light snow; low drifting snow mostly cloudy wind 11.2 m/s SSE (34 m above NAP)
--
Ervaringen met het Syndroom van Asperger:
  http://topjaklont.student.utwente.nl
Socialistische Partij:
  http://www.sp.nl/