plot.py 文件源码

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

项目:powerplantmatching 作者: FRESNA 项目源码 文件源码
def bar_fueltype_totals(dfs, keys, figsize=(7,4), unit='GW', show_totals=False, 
                        last_as_marker=False):
    with sns.axes_style('darkgrid'):
        fig, ax = plt.subplots(1,1, figsize=figsize)
        if last_as_marker:
            as_marker = dfs[-1]
            dfs = dfs[:-1]
            as_marker_key = keys[-1]
            keys = keys[:-1]
        fueltotals = lookup(dfs,
                   keys=keys, by='Fueltype'
                   ,show_totals=show_totals, unit=unit)
        fueltotals.plot(kind="bar",
                           ax=ax, legend='reverse', edgecolor='none', rot=75)
        if last_as_marker:
            fueltotals = lookup(as_marker,
                        keys=as_marker_key, by='Fueltype'
                       ,show_totals=show_totals, unit=unit)
            fueltotals.plot(ax=ax, label=as_marker_key, markeredgecolor='none', rot=75, 
                            marker='D', markerfacecolor='darkslategray', linestyle='None')

        ax.legend(loc=0)
        ax.set_ylabel(r'Capacity [$%s$]'%unit)
        ax.xaxis.grid(False)
        fig.tight_layout(pad=0.5)
        return fig, ax
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号