import pandas as pd import matplotlib.pyplot as plt if __name__ == '__main__': weeks = pd.read_excel("C:/Users/123/Desktop/pandas/013_折线趋势图_叠加区域图/Orders.xlsx", index_col="Week") print(weeks.columns) print(weeks.head(5)) # 折线趋势图 - 多列数据 weeks.plot(y = ['Accessories']) plt.title("Accessories Trands", fontsize = 16, fontweight = "bold") plt.xticks(weeks.index, fontsize = 3) plt.show() # 折线趋势图 - 多列数据 weeks.plot(y = ['Accessories', 'Bikes', 'Clothing', 'Components']) plt.title("Accessories Trands", fontsize=16, fontweight="bold") plt.ylabel("Total", fontsize = 12, fontweight = "bold") plt.xticks(weeks.index, fontsize = 8) plt.show() # 叠加柱状图 weeks.plot.bar(y = ['Accessories', 'Bikes', 'Clothing', 'Components'], stacked = True) plt.title("Sales Trands", fontsize = 16, fontweight = "bold") plt.xticks(weeks.index, fontsize = 8) plt.show() # 叠加区域图 weeks.plot.area(y = ['Accessories', 'Bikes', 'Clothing', 'Components']) plt.title("Sales Trands", fontsize = 16, fontweight = "bold") plt.xticks(weeks.index, fontsize = 8) plt.show()