|
From: John H. <jdh...@ac...> - 2005-04-15 03:25:49
|
>>>>> "Joe" == Joe Wu <jw...@sd...> writes:
Joe> Sorry if this question has been asked before: Has anyone
Joe> written a locator class which acts like the AutoLocator but
Joe> picks the best DateLocator based on current time span?
Joe> For date plots, zooming in/out can yield no tick marks or too
Joe> many tick marks, and I think using such a class can solve
Joe> this problem. Any suggestion for other approach?
Take a look at Axes.plot_date. It inspects the date range and tries
to pick a good locator and formatter. You could wrap this
functionality into an AutoDateLocator, following the model of
AutoLocator.
There is a slight wrinkle here in that you want an AutoDateFormatter
as well, but this shouldn't be any harder. Again you can reuse the
logic of plot_date to pick the right format string dynamically.
If you succeed, please send it my way and I'll use it in plot_date.
JDH
|