zoukankan      html  css  js  c++  java
  • 013_折线趋势图_叠加区域图

    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()
  • 相关阅读:
    C++
    复盘-2018.6.8~2020.6.8
    C++
    C++
    C++
    C++
    Python学习笔记(十)- 面向对象(一)
    SSHException: Error reading SSH protocol banner
    docker 安装mysql
    docker 安装部署
  • 原文地址:https://www.cnblogs.com/huafan/p/14409606.html
Copyright © 2011-2022 走看看