From: John H. <jdh...@ac...> - 2006-09-04 16:43:05
|
>>>>> "Michael" == Michael Fitzgerald <mp...@be...> writes: Michael> I placed that command before the ax.get_xticklabels(), Michael> and no dice. Michael> Thanks for looking into this, Mike I took a look at the formatter code and it turns out it *does* know the list of locations it has to format. I was wrong about this in my previous post. The formatter has a locs attribute you can inspect to see how many ticks there are. So you should be able to do something like class MyFormatter(ScalarFormatter): def __call__(self, x, pos=None): N = len(self.locs) if pos==0: return '' # turn off first elif pos==(N-1): return '' # turn off last else: return ScalarFormatter(self, x, pos) and you can do other things similarly, eg to turn off every other tick if (pos%2)==0: return '' If you want to get very clever with turning on and off certain ticks, you can also create a custom locator derived from the Locator class you are using. JDH |