In matplotlib plots, scientific notation and axis offsets are two distinct features. Here's how to control them separately:
To disable scientific notation (multiplier), use ax.ticklabel_format(style='plain') or plt.ticklabel_format(style='plain').
fig, ax = plt.subplots() ax.plot(range(2003, 2012, 1), range(200300, 201200, 100)) ax.ticklabel_format(style='plain') plt.show()
To disable axis offset (addition), use ax.ticklabel_format(useOffset=False) or plt.ticklabel_format(useOffset=False).
fig, ax = plt.subplots() ax.plot(range(2003, 2012, 1), range(200300, 201200, 100)) ax.ticklabel_format(useOffset=False) plt.show()
To disable both simultaneously, use ax.ticklabel_format(useOffset=False,> or plt.ticklabel_format(useOffset=False,>.
fig, ax = plt.subplots() ax.plot(range(2003, 2012, 1), range(200300, 201200, 100)) ax.ticklabel_format(useOffset=False,>
The above is the detailed content of How to Prevent Scientific Notation and Axis Offsets in Matplotlib Plots?. For more information, please follow other related articles on the PHP Chinese website!