Python/Matplotlib:如何在带有刻度但没有刻度标签的子图中绘图?

Iso*_*ion 1 python axes matplotlib axis-labels

我可以删除刻度标签:

ax.axes.get_yaxis().set_visible(False)
Run Code Online (Sandbox Code Playgroud)

但这也消除了蜱虫.我想保留蜱虫.

tac*_*ell 5

只需使用一个 NullFormatter

ax = plt.gca()
ax.yaxis.set_major_formatter(matplotlib.ticker.NullFormatter())
plt.draw()
Run Code Online (Sandbox Code Playgroud)