Python matplotlib默认情况下删除轴标签偏移

Python matplotlib默认情况下删除轴标签偏移,python,matplotlib,Python,Matplotlib,我在这里读到了其他问题 plt.gca().get_xaxis().get_major_formatter().set_useOffset(False) 作为在当前绘图上删除轴偏移的一种方法,但默认情况下是否有任何方法可以执行此操作?我在matplotlibrc文件中看不到任何有用的东西。不,没有办法。它在源文件ticker.py第353行定义: def __init__(self, useOffset=True, useMathText=None, useLocale=None):

我在这里读到了其他问题

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

作为在当前绘图上删除轴偏移的一种方法,但默认情况下是否有任何方法可以执行此操作?我在matplotlibrc文件中看不到任何有用的东西。

不,没有办法。它在源文件
ticker.py
第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)
作为默认参数值。因此默认值为
True

当然,您可以修改源代码

添加了一个名为Axis.formatter.useoffset的布尔matplotlibrc参数,该参数可以关闭偏移

例如:

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

你能给我们加一行,告诉我们matplotlib perma noobs如何使用它吗?谢谢(类似)。@uhoh
导入matplotlib.pyplot作为plt;plt.rcParams['axes.formatter.useoffset']=False同样可能。使用subplot2grid时不起作用,参数被忽略。这个答案是错误的,就地编辑安装是一个非常糟糕的主意。