Skip to main content
 首页 » 编程设计

python /Matplotlib : How to plot in a subplot with ticks but no tick labels

2025年05月04日11jyk

我可以删除刻度标签:

ax.axes.get_yaxis().set_visible(False) 

但这也消除了滴答声。我想保留蜱虫。

请您参考如下方法:

只需使用一个NullFormatter

ax = plt.gca() 
ax.yaxis.set_major_formatter(matplotlib.ticker.NullFormatter()) 
plt.draw()