matplotlib画图X轴数据太多(例如时间)如何只显示一部分


from matplotlib import ticker
plt.plot(train['first_active_month'].value_counts().sort_index())

# 参数为间隔数量 
plt.gca().xaxis.set_major_locator(ticker.MultipleLocator(12))

  

  

 

posted @ 2021-12-31 10:28  麦扣  阅读(1906)  评论(0编辑  收藏  举报