It seems like this should be easy - but I don't see how to do it:
I have a graph with time along the X axis. I want to set two sets of ticks, minor ticks showing the hour of the day and the main ticks showing the day / month. So I do this:
# set date ticks to something sensible: xax = ax.get_xaxis() xax.set_major_locator(dates.DayLocator()) xax.set_major_formatter(dates.DateFormatter('%d/%b')) xax.set_minor_locator(dates.HourLocator(byhour=range(0,24,3))) xax.set_minor_formatter(dates.DateFormatter('%H'))
This indicates the ticks in order, but the main label labels (day / month) are drawn on top of the label labels:

How to make shortcuts of main labels draw below secondary? I tried putting line break characters (\ n) in DateFormatter, but this is a bad solution, since the vertical spacing is not quite right.
Any advice would be appreciated!
python matplotlib plot axis-labels
ccbunney
source share