python旋转x轴标签

fig, ax = plt.subplots(1, 2, sharey=True, figsize=(20,10))
fig.suptitle('Top and Bottom Countries by Rating')
plt.xticks(rotation=45)
  1. 方法一:
plt.xticks(bins_interval, label, fontsize=18, rotation='45')
  1. 方法二:
fig.autofmt_xdate(rotation=45)
  1. 方法三:
labels = ['One', 'Two', 'Three'] #your labels
ax.set_xticks([1, 2, 3]) #your coord
ax.set_xticklabels(labels, rotation=45)
  1. 方法四:
ax.tick_params(axis='x', labelrotation=45)

你可能感兴趣的:(Python绘图,python,matplotlib)