Hi all,
I have a derived class that I copy-pasted from the web somewhere to hide some tick labels:
class MinorLogTickFormatter(matplotlib.ticker.LogFormatter):
Format log scale with 10^ labels. Only if show one label over two.
def call(self, val, pos=None):
exponent = int(numpy.floor(numpy.log(abs(val))/numpy.log(self._base)))
base = int(val / 10.0**exponent)
isDecade = self.is_decade(exponent)
if not isDecade and self.labelOnlyBase:
return ‘’
if (not (base == 2 or base == 4 or base == 6 or base == 8)): # Only show these ones.
return ‘’
label = r"$%d \times 10^{%d}$" % (base, exponent)
return label
pylab.gca().xaxis.set_minor_formatter(MinorLogTickFormatter())
I’ve beend using this since many months, but with matplotlib 1.0.1 I can’t anymore. It complains about the is_decade() function:
isDecade = self.is_decade(exponent)
AttributeError: MinorLogTickFormatter instance has no attribute ‘is_decade’
How can I fix that?
Thanks!
Nicolas