import pandas as pd
import matplotlib.pyplot as plt
students = pd.read_excel('D:/Code/.vscode/Students.xlsx')
students.sort_values(by='Number',inplace=True,ascending=False)
print(students)
# students.plot.bar(x='Field',y='Number',color='orange',title= 'international Students by field')
plt.bar(students.Field,students.Number,color = 'orange')
plt.xticks(students.Field,rotation = '90')
plt.xlabel('Field')
plt.ylabel('Number')
plt.title('International Students by field',fontsize=16)
plt.tight_layout()
plt.show()
Matplotlib 数据可视化
最新推荐文章于 2024-06-19 17:52:16 发布