【发布时间】:2020-04-03 23:26:40
【问题描述】:
假设我有以下代码:
import matplotlib as mpl
from matplotlib import pyplot as plt
x =[10, 14, 19, 26, 36, 50, 70, 98, 137, 191, 267, 373, 522, 730, 1021, 1429, 2000, 2800, 3919, 5486, 7680]
y = [ 0.0085, 0.006900000000000001, 0.007600000000000001, 0.007600000000000001, 0.01, 0.008700000000000003, 0.0094, 0.008800000000000002, 0.0092, 0.009, 0.009999999999999998, 0.010099999999999998, 0.010899999999999998, 0.010899999999999998, 0.011, 0.0115, 0.0115, 0.0118, 0.013000000000000001, 0.0129, 0.0131]
fig, ax1 = plt.subplots()
ax1.plot(x,y,linewidth=1)
ax1.set_xscale('log')
ax1.set_yscale('log')
plt.show()
结果如下:
我想要做的是删除 y 轴上 不是 10 次方的刻度。在这个特定示例中,删除 9x10^-3、8x10^-3 等,并且只保留 10^-2。
我尝试了其他一些建议,例如this one 但他们都没有工作.. 有什么想法吗?
【问题讨论】:
标签: python python-3.x matplotlib plot