Matplotlib中的偏移值(Python)

时间:2014-03-14 11:49:58

标签: python matplotlib

这是来自this post的后续问题。我可以将x轴定义为x 10^4而不是+55478吗?如果没有考虑因素,我的一些数据会更有意义。我打算发布图片,但我没有足够的意义:(。谢谢,

1 个答案:

答案 0 :(得分: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-')

enter image description here