Format axis offset-values to whole numbers or specific number

I had exactly the same problem, and these lines fixed the problem:

from matplotlib.ticker import ScalarFormatter

y_formatter = ScalarFormatter(useOffset=False)
ax.yaxis.set_major_formatter(y_formatter)

Leave a Comment