我已经阅读了这里提供的其他问题
plt.gca().get_xaxis().get_major_formatter().set_useOffset(False)
作为一种消除当前绘图轴偏移的方法,但是否有默认的方法可以实现这一点?我在matplotlibrc文件中没有看到任何有用的内容。
我已经阅读了这里提供的其他问题
plt.gca().get_xaxis().get_major_formatter().set_useOffset(False)
作为一种消除当前绘图轴偏移的方法,但是否有默认的方法可以实现这一点?我在matplotlibrc文件中没有看到任何有用的内容。
在2013年,添加了一个名为axes.formatter.useoffset
的布尔matplotlibrc参数,可以关闭偏移量。
例如像这样:
import matplotlib as mpl
mpl.rcParams['axes.formatter.useoffset'] = False
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
。
当然,您可以修改源代码。
import matplotlib.pyplot as plt; plt.rcParams['axes.formatter.useoffset'] = False
同样可行。 - ImportanceOfBeingErnest