I've seen a lot of solutions where the tick marks are placed at specific location: I want the tick marks to be automatically spaced, but I only want ten of them. I haven't seen any solutions for setting an exact number of ticks. Preferably, the ends of the figure will also be labeled with the tick marks. How can I just set the number of tick marks?
Asked
Active
Viewed 3,904 times
1 Answers
-1
pyplot.locator_params(axis='y', nbins=10) # y-axis
pyplot.locator_params(axis='x', nbins=10) # x-axis
pyplot.locator_params(nbins=10) # both
See also: http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.locator_params

B. Eckles
- 1,626
- 2
- 15
- 27
-
nticks didn't work, but nbins did. – adamcircle Jun 12 '17 at 16:41