Um 90 Grad drehen:
plt.xticks (Drehung = 90, Schriftgröße = 13)
Passen Sie die Reihenfolge an:
plt.xticks (Bereich (len (x)), x)
plt.bar (Bereich (len (x)), y, Farbe = 'g')
Beispielcode:
# 设置数据
x = np.array(top10['景点名称'])
y = np.array(top10['综合得分'])
print(x, y)
plt.xticks(range(len(x)), x)
# 绘图
plt.bar(range(len(x)), y, color = 'g')
plt.xlabel('景点名称', fontsize=16)
plt.xticks(rotation=90,fontsize=13)
plt.ylabel('综合得分', fontsize=16)
plt.title('综合得分前十景点', fontsize=18)
plt.savefig('./image/综合得分前十景点.png')
plt.show()