How to remove relative shift in matplotlib axis
plot([1000, 1001, 1002], [1, 2, 3])gca().get_xaxis().get_major_formatter().set_useOffset(False)draw()
This grabs the current axes
, gets the x-axis axis
object and then the major formatter object and sets useOffset to false (doc).
In newer versions (1.4+) of matplotlib the default behavior can be changed via the axes.formatter.useoffset
rcparam.
To disable relative shift everywhere, set the rc parameter:
import matplotlibmatplotlib.rc('axes.formatter', useoffset=False)