user3400793
user3400793

Reputation: 39

Offset value in Matplotlib (Python)

This is the follow up question from this post. Can I define the x-axis as x 10^4 instead of +55478? Some of my data would be more meaningful if it is not factored out. I was planning to post the image but I don't have enough point :(.Thanks,

Upvotes: 1

Views: 1900

Answers (1)

Aung
Aung

Reputation: 463

You can change the default value from this 'the axes.formatter.limits': [-7, 7] to plt.rcParams['axes.formatter.limits']=(-3,3). Or

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

Upvotes: 3

Related Questions