1 import pandas 2 from matplotlib import pyplot 3 pyplot.rcParams['font.sans-serif']=['simhei'] #显示中文标签 4 pyplot.rcParams['axes.unicode_minus']=False 5 6 #绘制折线图 7 excel=pandas.read_excel('填充日期.xlsx',index_col='name') 8 excel.plot(y=['score1','score2','score3']) 9 pyplot.title('学生成绩',fontsize=16,fontweight='bold') 10 pyplot.ylabel('分数',fontsize=16,fontweight='bold') 11 12 13 #生成叠加区域图 14 excel.plot.area(y=['score1','score2','score3']) 15 #生成叠加柱状图 16 excel.plot.bar(y=['score1','score2','score3'],stacked=True) 17 18 19 pyplot.show()