matplotlib's axis-formatting options tend to fall flat when it comes to plotting and effectively labeling dense time-series data.
One problem is that tick labels are tied to ticks, so if you set axis ticks at an appropriate frequency, there are usually too many labels. This also means that if you are plotting, say, daily data over a period of several years, there is no good way to label the x-axis with each year in its natural position: centered under the year's data (i.e., under the x-axis position for July 2, or thereabouts).
The trick described in this example—set major ticks where you want them, then use invisible minor ticks to place the labels elsewhere—works, but it limits you to one visible set of axis ticks (since each axis is limited to one set of major and one set of minor ticks). You can't show, say, major ticks at the start of each year and minor ticks at the start of each month without giving up the ability to put year labels centered appropriately between the major (yearly) ticks, as you would find in publication-quality plots.
Is there a work-around that doesn't involve drawing everything fully manually?
Have you looked at the tsplot capability in scikits.timeseries? It hasn't been maintained much recently, but it works pretty well. I'll be porting that code into pandas at some point in the relative near future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With