scaling date ticking

Hello list,

I am plotting some time series data, and the ranges vary dramatically. I cannot find a way to configure the major and minor ticking (hours and days respectively) to scale automatically: if the range is too large, put a tick every 8 hours instead of one, or even place a minor day tick every week and dont do any hour ticking.

ax.plot_date(date2num(times),points,'-',color="blue")

days = DayLocator()
daysFmt = DateFormatter('%d/%m')
ax.xaxis.set_minor_locator(days)
ax.xaxis.set_minor_formatter

(daysFmt)
hours = HourLocator()
hours.autoscale()
hoursFmt = DateFormatter(’%H’)
ax.xaxis.set_major_locator(hours)
ax.xaxis.set_major_formatter(hoursFmt)

for tick in ax.xaxis.get_minor_ticks():
    tick.set_pad(13)   

The pad trick is a cool answer I got in a previous post.