当我提交申请时:
ax.set_yscale('log')
对于matplotlib中的轴,它会在每个10的倍数处生成一个刻度线。有时候这会太多了,比如下面的截图所示:
![enter image description here](https://istack.dev59.com/pQtSr.webp)
如何在matplotlib中实现呢?
当我提交申请时:
ax.set_yscale('log')
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import LogLocator
x = np.linspace(0, 10, 10)
y = 2**x
f = plt.figure()
ax = f.add_subplot(111)
plt.yscale('log')
ax.yaxis.set_major_locator(LogLocator(base=100))
ax.plot(x, y)
plt.show()
如果您愿意,可以使用相同的小定位器,或者以任何您喜欢的方式进行调整。