plotting.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:financial_life 作者: MartinPyka 项目源码 文件源码
def plot_stack_cum(semantic, *reports, color_theme = C_cold_colors, color_offset = 0):
    """ Creates a stacked plot with cumulated sums for a given semantic """ 
    X, Y, c = extract_data(semantic, *reports, color_theme = color_theme, color_offset = color_offset)
    Y = remove_nones(Y)
    # add zeros only at the beginning    
    for x in X:
        x.insert(0, x[0] - 1)

    for data in Y:
        for d in data:
            d.insert(0, 0.)

    # create the cumulated sum
    Y = [np.cumsum(np.array(yi), 1) if yi else [] for yi in Y]

    plot_stack_generic(X, Y, c, semantic, *reports, color_theme = color_theme, color_offset = color_offset)
    legend(loc = 'upper left', fancybox=True, framealpha=0.4, prop={'size':10})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号