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))
from matplotlib import ticker
plt.plot(train['first_active_month'].value_counts().sort_index())
# 参数为间隔数量
plt.gca().xaxis.set_major_locator(ticker.MultipleLocator(12))