Matplotlib中的偏移值(Python)

1 投票
1 回答
1854 浏览
提问于 2025-04-17 22:18

这是一个跟这个帖子相关的后续问题。我可以把x轴定义为x 10^4,而不是+55478吗?如果不进行因子化,我的一些数据会更有意义。我本来打算发图片的,但我没有足够的积分 :(. 谢谢!

1 个回答

3

你可以把默认的值从 'the axes.formatter.limits': [-7, 7] 改成 plt.rcParams['axes.formatter.limits']=(-3,3)。或者

plt.rcParams['figure.figsize'] = (9,9)
x = np.linspace(55478, 55486, 100) 
y = np.random.random(100) - 0.5
y = np.cumsum(y)
plt.ticklabel_format(style='sci', axis='both', scilimits=(0,0),useOffset=False)
plt.plot(x,y,'b-')

在这里输入图片描述

撰写回答