基本绘图
利用pandas
import pandas as pd
import matplotlib.pyplot as plt
students=pd.read_excel('009\Students.xlsx')
students.sort_values(by='Number',ascending=False,inplace=True)#排完序后,生成一个新的DataFrame,inplace替代
print(students)
students.plot.bar(x='Field',y='Number',color='orange',title='International Students')
plt.show()#利用matplotlib显示
利用matplotlib
绘图
plt.bar(students.Field,students.Number,color='orange')
横坐标刻度标签
plt.xticks(students.Field,rotation=90)
横坐标名称标签
plt.xlabel('Field')
plt.ylabel('Number')
标题