Чтобы получить предопределенный формат для меток при сохранении научного множителя , вы можете использовать упрощенную версию OOMFormatter
из моего ответа здесь .
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.ticker
class FFormatter(matplotlib.ticker.ScalarFormatter):
def __init__(self, fformat="%1.1f", offset=True, mathText=True):
self.fformat = fformat
matplotlib.ticker.ScalarFormatter.__init__(self,useOffset=offset,useMathText=mathText)
def _set_format(self, vmin, vmax):
self.format = self.fformat
if self._useMathText:
self.format = '$%s$' % matplotlib.ticker._mathdefault(self.format)
x = np.linspace(1/10000, 1/2000, 13)
y = x**2
plt.plot(x, y, 'ro')
plt.xticks(x, rotation=45)
fmt = plt.gca().xaxis.set_major_formatter(FFormatter(fformat="%1.1f"))
plt.ticklabel_format(style='sci', axis='x', scilimits=(0,0), useMathText=True)
plt.show()
