You can use the MaxNLocator
method, like so:
from pylab import MaxNLocator
ya = axes.get_yaxis()
ya.set_major_locator(MaxNLocator(integer=True))
More Related Contents:
- Secondary axis with twinx(): how to add to legend?
- How to remove relative shift in matplotlib axis
- How to share x axes of two subplots after they have been created
- Python, Matplotlib, subplot: How to set the axis range?
- matplotlib (equal unit length): with ‘equal’ aspect ratio z-axis is not equal to x- and y-
- Axes class – set explicitly size (width/height) of axes in given units
- How to set the subplot axis range
- Setting the position of the `ylabel`
- How to set the ‘equal’ aspect ratio for all axes (x, y, z)
- Aligning y-ticks to the left
- X-axis tick labels are too dense when drawing plots
- Rotate axis tick labels
- Changing the color of an axis
- How to make IPython notebook matplotlib plot inline
- Pandas – Plotting a stacked Bar Chart
- Which is the recommended way to plot: matplotlib or pylab?
- Remove xticks in a matplotlib plot?
- How to give a pandas/matplotlib bar graph custom colors
- Colorize Voronoi Diagram
- matplotlib error – no module named tkinter
- How to draw a rectangle over a specific region in a matplotlib graph
- How do I get interactive plots again in Spyder/IPython/matplotlib?
- Creating intersecting images in matplotlib with imshow or other function
- How to set xlim and ylim for a subplot [duplicate]
- How to make an axes occupy multiple subplots with pyplot
- Plot a histogram from a Dictionary
- Underlining Text in Python/Matplotlib
- How to remove xticks from a plot
- Figure to image as a numpy array
- Horizontal stacked bar chart in Matplotlib