graph - How to prevent numbers being changed to exponential form in Python matplotlib figure -


i'm using matplotlib in python plot simple x-y datasets. produces nice-looking graphs, although when "zoom in" close on various sections of plotted graph using figure view (which appears when execute plt.show() ), x-axis values change standard number form (1050, 1060, 1070 etc.) scientific form exponential notation (e.g. 1, 1.5, 2.0 x-axis label given +1.057e3).

i'd prefer figures retain simple numbering of axis, rather using exponential form. there way can force matplotlib this?

the formatting of tick labels controlled formatter object, assuming haven't done fancy scalerformatterby default. formatter use constant shift if fractional change of values visible small. avoid this, turn off:

plt.plot(arange(0,100,10) + 1000, arange(0,100,10)) ax = plt.gca() ax.get_xaxis().get_major_formatter().set_useoffset(false) plt.draw() 

if want avoid scientific notation in general,

ax.get_xaxis().get_major_formatter().set_scientific(false) 

can control globally via axes.formatter.useoffset rcparam.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -