matplotlib——default formatter

335 阅读1分钟

为了减少ticklabel之间的重叠,在label表示的数字太大的时候,会把每一个label设置成某个较大值的增量。

import matplotlib.pyplot as plt
import numpy as np
fig,ax=plt.subplots()
ax.plot(np.arange(100000,100010),range(10))

在不想使用default formatter的时候,可以使用:

ax.get_xaxis().get_major_formatter().set_useOffset(False)