import pandas as pd
import matplotlib.pyplot as plt
students = pd.read_excel('D:/Code/.vscode/Students.xlsx')
students.sort_values(by = '2017',inplace = True, ascending=False)
print(students)
students.plot.bar(x='From',y=['2016','2017'],color=['orange','red'])
plt.title('International Students by Field',fontsize=16,fontweight='bold')
plt.xlabel('From',fontweight='bold')
plt.ylabel('Number',fontweight='bold')
ax =plt.gca()
ax.set_xticklabels(students['From'],rotation=45,ha='right')
f = plt.gcf()
f.subplots_adjust(left=0.2,bottom=0.42)
plt.tight_layout()
plt.show()
Matplotlib 可视化之图形美化
最新推荐文章于 2024-02-15 02:49:29 发布