11
votes

I've read other questions here offering

plt.gca().get_xaxis().get_major_formatter().set_useOffset(False)

as a way to remove axis offsets on the current plot, but is there any way to do this by default? I don't see anything in the matplotlibrc file that seems helpful.

2

2 Answers

3
votes

No, there is no way to do it. It is defined in the source file of ticker.py, line 353:

def __init__(self, useOffset=True, useMathText=None, useLocale=None):
    # useOffset allows plotting small data ranges with large offsets: for
    # example: [1+1e-9,1+2e-9,1+3e-9] useMathText will render the offset
    # and scientific notation in mathtext

    self.set_useOffset(useOffset)

as a default parameter values. So the default is True.

You can modify the source, of course.

13
votes

In 2013 a boolean matplotlibrc parameter called axes.formatter.useoffset was added, which can switch off the offset.

For example like this:

import matplotlib as mpl
mpl.rcParams['axes.formatter.useoffset'] = False