|
From: C M <cmp...@gm...> - 2010-11-29 01:52:43
|
How can I correctly subclass AutoDateFormatter and use it in my code?
What I am doing is copying the code from matplotlib's AutoDateFormatter and
changing the strings for how the dates are represented and making that a
class, MyAutoDateFormatter. AutoDateFormatter expects a locator, and I
think (?) the default is AutoDateLocator. So in my code I am doing this:
adl = AutoDateLocator()
myformatter = MyAutoDateFormatter(adl)
axis.xaxis.set_major_formatter(myformatter)
But when I run it, no matter the level of zoom, it says "2010" (when it
should change depending on zoom level).
However, if I go into the matplotlib dates.py code itself and save the same
changes to the date strings there, and I comment out the above code, then it
works: the date strings change depending on level of zoom.
I could just leave it changed in mpl's dates.py module, but I'd rather
subclass AutoDateFormatter so that if I share the source code of my app with
others, it will get this right.
What am I doing wrong?
Thanks, and any help appreciated as always.
Che
|