Matplotlib.pyplot: label of the exponential axis of the force

In the graph created by matplotlib.pyplot, how can I make axis labels appear in exponential notation? This seems to be done automatically for values ​​<1e-6, but say 5e-6, I get "0.000005". I would prefer it to be shown as "5e-6" also for this range.

+6
source share
1 answer

It seems that you should set the ScalarFormatter power ScalarFormatter for the axes. (unverified 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)) 
+5
source

Source: https://habr.com/ru/post/950214/


All Articles