matplotlib科学符号整数1e3

matplotlib科学符号整数1e3,matplotlib,Matplotlib,如何用整型棒和科学符号1e3绘制yaxis显示 from matplotlib import pyplot as plt import numpy as np fig, ax = plt.subplots(1, 1) x = np.linspace(0, 5, 11) y = x**4 ax.plot(x, x ** 2, x, np.exp(x)) ax.set_title("scientific notation") ax.set_yticks([100, 5000,

如何用整型棒和科学符号1e3绘制yaxis显示

from matplotlib import pyplot as plt
import numpy as np
fig, ax = plt.subplots(1, 1)
x = np.linspace(0, 5, 11)
y = x**4
ax.plot(x, x ** 2, x, np.exp(x))
ax.set_title("scientific notation")

ax.set_yticks([100, 5000, 10000, 15000])

from matplotlib import ticker

formatter = ticker.ScalarFormatter(useMathText=True)
formatter.set_scientific(True)
formatter.set_powerlimits((-1, 1))
ax.yaxis.set_major_formatter(formatter)

plt.show()
此代码显示1.50 x 10^4, 现在我想展示15x10^3

你们能帮帮我吗

谢谢