余姿函的學習歷程 - 大數據 - 9.時間序列圖
 

夜四技企資三甲
1101AD004
余姿函


歷程檔案 Portfolio

    9.時間序列圖

    import seaborn as sns
    import pandas as pd
    import matplotlib.pyplot as plt
    # 建立資料
    my_count = ["France""Australia""Japan""USA""Germany""Congo""China""England""Spain""Greece""Marocco",
                "South Africa""Indonesia""Peru""Chili""Brazil"]
    df = pd.DataFrame({
        "country": np.repeat(my_count, 10),
        "years"list(range(20002010)) * 16,
        "value": np.random.rand(160)
    })
    # 建立網格
    g = sns.FacetGrid(df, col='country', hue='country', col_wrap=4, )
    # 新增曲線圖
    g = g.map(plt.plot, 'years''value')
    # 面積圖
    g = g.map(plt.fill_between, 'years''value', alpha=0.2).set_titles("{col_name} country")
    # 標題
    g = g.set_titles("{col_name}")
    # 總標題
    plt.subplots_adjust(top=0.92)
    g = g.fig.suptitle('Evolution of the value of stuff in 16 countries')
    # 顯示
    全部共 0則留言
    登入帳號密碼代表遵守學術網路規範


    文章分類 Labels


    最新文章 Top10

    中華科技大學數位化學習歷程 - 意見反應