The simplest answer: use latex mode:
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
x = np.arange(10000, 10011)
plt.plot(x)
plt.show()
Result:

EDIT
In fact, you do not need to use latex. ScalarFormatter, which is used by default, has the ability to use scientific notation:
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
x = np.arange(10000, 10011)
fig, ax = plt.subplots(1)
ax.plot(x)
formatter = mticker.ScalarFormatter(useMathText=True)
ax.yaxis.set_major_formatter(formatter)
plt.show()
Result:

hitzg source
share