Matplotlib remove default axis label offset

I read other questions suggesting

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

as a way to remove axis offsets on the current chart, but is there a way to do this by default? I do not see anything in the matplotlibrc file, which seems useful.

+6
python matplotlib
Jun 11 '14 at 19:28
source share
2 answers

No, there is no way to do this. It is defined in the source file 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 default parameter values. The default value is True .

Of course you can change the source code.

+5
Jun 11 '14 at 21:13
source share

In 2013, the logical parameter matplotlibrc was added with the name axes.formatter.useoffset , which can disable the offset.

For example, for example:

 import matplotlib as mpl mpl.rcParams['axes.formatter.useoffset'] = False 
+4
Apr 09 '15 at 10:20
source share



All Articles