python使用matplotlib画图时设置x轴刻度
plt.rcParams['font.family'] = ['KaiTi']
plt.rcParams['axes.unicode_minus'] = False
%matplotlib inline
figure = plt.figure(figsize=(26,8))
ax1 = figure.add_subplot(1,1,1)
ax1.plot(host_df['deviceTemp'],color='green',label='temp')
ticks = ax1.set_xticks(list(range(0,8501, 500)))
tims = host_df.loc[list(range(0,8501, 500)),'time']
labels = ax1.set_xticklabels(tims, rotation=90,fontsize='small')
ax1.set_title('温度变化折线图')
plt.legend(loc=1)
plt.show()
结果展示: