Managing y axis offset (large) numbers to show in y-ticks instead of at the top by default

41 Views Asked by At
import matplotlib.pyplot as plt
y=[10001, 10002, 10000]
plt.plot(y,'o--')

plot showing offset number on top

In this image, the y ticks are corresponding the remainder of the numbers beyond 10000, which is shown on the top. I do not like this behavior and like to turn it off by default if possible.

I could not find the answer. I don't know if manually controlling the tick positions is going to fix this but I prefer to disable this way of plotting by default.

2

There are 2 best solutions below

2
Jesse Sealand On

Solution:

Turn off scientific notation for axis plots. This happens under 'ticklabel_format' as follows

import matplotlib.pyplot as plt
y=[10001, 10002, 10000]
plt.plot(y,'o--')
plt.ticklabel_format(style='plain')
plt.show()
0
user22525194 On

To change for a plot plt.ticklabel_format(useOffset=False)

To change default setting plt.rcParams['axes.formatter.useoffset'] = False