matplotlib remove axis label offset by default

后端 未结 2 901
礼貌的吻别
礼貌的吻别 2020-12-06 11:48

I\'ve read other questions here offering

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

as a way to remove axis offsets o

相关标签:
2条回答
  • 2020-12-06 12:12

    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.

    0 讨论(0)
  • 2020-12-06 12:12

    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
    
    0 讨论(0)
提交回复
热议问题