C
Caleb Hattingh
Hi
I tried several Google searches to no avail. I read through pretty
much most of the online docs at the matplotlib sourceforge site, but
didn't find what I was looking for. I went through the axis.py and
ticker.py code today, trying to find out how to set the number of
points (ticks) on an axis in Matplotlib.
I know that something like
will make the x-axis have the values specified, but Matplotlib appears
to have a very nice way of setting axis ticks with human-friendly
values that round in just the right way for a given set of data. I
still want that functionality, but I want to set how many ticks are on
a given axis.
It seems that the locater() classes are where I should look, and there
seem to be some defaults in ticker.py:
class AutoLocator(MaxNLocator):
def __init__(self):
MaxNLocator.__init__(self, nbins=9, steps=[1, 2, 5, 10])
I don't understand what this means
I would prefer not to hack this directly in the matplotlib code. How
can I change the number of ticks on an axis programmatically without
messing with the other ticklabel functionality?
Caleb
I tried several Google searches to no avail. I read through pretty
much most of the online docs at the matplotlib sourceforge site, but
didn't find what I was looking for. I went through the axis.py and
ticker.py code today, trying to find out how to set the number of
points (ticks) on an axis in Matplotlib.
I know that something like
will make the x-axis have the values specified, but Matplotlib appears
to have a very nice way of setting axis ticks with human-friendly
values that round in just the right way for a given set of data. I
still want that functionality, but I want to set how many ticks are on
a given axis.
It seems that the locater() classes are where I should look, and there
seem to be some defaults in ticker.py:
class AutoLocator(MaxNLocator):
def __init__(self):
MaxNLocator.__init__(self, nbins=9, steps=[1, 2, 5, 10])
I don't understand what this means
I would prefer not to hack this directly in the matplotlib code. How
can I change the number of ticks on an axis programmatically without
messing with the other ticklabel functionality?
Caleb