Here is another way:
from matplotlib.ticker import MaxNLocator
ax = plt.figure().gca()
ax.yaxis.set_major_locator(MaxNLocator(integer=True))
More Related Contents:
- Aligning rotated xticklabels with their respective xticks
- Show decimal places and scientific notation on the axis of a matplotlib plot
- How to increase/reduce the fontsize of x and y tick labels
- Matplotlib showing x-tick labels overlapping
- Overlapping yticklabels: Is it possible to control cell size of heatmap in seaborn?
- Show decimal places and scientific notation on the axis
- Rotate axis tick labels
- Modify tick label text
- How to animate a scatter plot
- How to equalize the scales of x-axis and y-axis in matplotlib
- What is the difference between pylab and pyplot? [duplicate]
- Paging/scrolling through set of 2D heat maps in matplotlib
- matplotlib – extracting data from contour lines
- Plot correlation matrix using pandas
- Matplotlib Plot Lines with Colors Through Colormap
- trouble aligning ticks for matplotlib twinx axes
- plotting a histogram on a Log scale with Matplotlib
- Understanding matplotlib: plt, figure, ax(arr)?
- Plotting a line over several graphs
- Matplotlib: Add colorbar to non-mappable object
- Changing width of bars in bar chart created using seaborn.factorplot
- Memory error while using pip install Matplotlib
- Could not find or load the Qt platform plugin “xcb”
- How do I customize the display of edge labels in networkx?
- Plotting time on the independent axis
- Color a scatter plot by Column Values
- Adding a matplotlib legend
- Is it possible to add a string as a legend item
- How to add a footnote under the x-axis of a plot
- Converting matplotlib png to base64 for viewing in html template