In a plot created by matplotlib.pyplot, how can I force the axis labels to be shown in exponential notation? This seems to be done automatically for values < 1e-6, but for, say, 5e-6 I get "0.000005". I'd prefer to have it shown as "5e-6" also for this range.
It seems like you should be able to set the power limits of the ScalarFormatter
for the axes. (untested code)
# Set limits to x < 10^1 and x > 10^-1
# (overlapping, thus all inclusive, hopefully)
gca().get_yaxis().get_major_formatter().set_powerlimits((0, 0))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With