At the moment if I set matplotlib y axis ticklabels to scientific mode it gives me an exponent at the top of the y axis of the form 1e-5
I\'d like to ad
It seems that plt.ticklabel_format
does not work correctly. However if you define the ScalarFormatter yourself and set the limits for scientific notation to the formatter, you can get the offset automatically in the mathtext format like so:
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.ticker
x = np.linspace(3,5)
y = np.sin(np.linspace(0,6*np.pi))*1e5
plt.plot(x,y)
mf = matplotlib.ticker.ScalarFormatter(useMathText=True)
mf.set_powerlimits((-2,2))
plt.gca().yaxis.set_major_formatter(mf)
plt.show()