0

Trying to plot a small chart with matplotlib, the plot end up as following:

enter image description here

I.e. there is a number written (quite big, i put a red rectangle around it) at the top of the chart, that has to be added to the y axis ticks to give their correct value. For instance "0.5" on the y axis, in fact means 0.5+2.431e3, i.e. 2431.5.

Obviously I am not very fond of that notation...

How can I change it so the chart displays 2431, 2432 etc on the y axis ticks?

jim jarnac
  • 4,804
  • 11
  • 51
  • 88

1 Answers1

-1

You can use a ScalarFormatter to tell matplotlib not to use an offset:

from matplotlib.ticker import ScalarFormatter
formatter = ScalarFormatter(useOffset=False)
gca().yaxis.set_major_formatter(formatter)
Till Hoffmann
  • 9,479
  • 6
  • 46
  • 64