Reputation: 73
I have been trying for several hours to globally turn off scientific notation and the offset in matplotlib. my attempt at a solution
import matplotlib as mpl
import matplotlib.pyplot as plt
The documentation says:
set the rcParam axes.formatter.useoffset=False to turn it off globally, or set a different formatter.
mpl.rcParams.formatter.useoffset = False
Of course this fails because there is no formatter for rcParam
mpl.ticker.FuncFormatter.__setattr__('set_scientific',False)
I am completely lost trying to do this. I have just switched from matlab. So I apologize if this is very basic
Upvotes: 3
Views: 2405
Reputation: 97291
You need to change the setting in setting file, you can get the current setting file path by following code:
import matplotlib as mpl
print mpl.matplotlib_fname()
if the file is in mpl-data folder, then copy it to user setting folder by following code:
import shutil
shutil.copy(mpl.matplotlib_fname(), mpl.get_configdir())
then restart you python session and show the path again:
print mpl.matplotlib_fname()
edit this file:
axes.formatter.useoffset : False
Is you only want to disable this in one of your programm, you can set the setting before any plot:
mpl.rcParams["axes.formatter.useoffset"] = False
Upvotes: 3