Reputation: 579
I have a graph over
[1,2,3,4,5]
with values that are quite small:
[0.000001,0.000002,...]
When I plot this, it shows the y axis ticks with the whole decimal. I would like something like
[1e-6,2e-6...]
to pop up instead. How can I do that?
Upvotes: 2
Views: 1391
Reputation: 193
This is probably what you are looking for:
import matplotlib.pyplot as plt ...
plt.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
style sci for scientific notation, axis y to format y axis only, m,n to include all numbers for which scientific notation should be applied (0,0 for all)
Upvotes: 2