graphics.py 文件源码

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

项目:activity-browser 作者: LCA-ActivityBrowser 项目源码 文件源码
def __init__(self, parent, mlca, width=6, height=6, dpi=100):
        figure = Figure(figsize=(width, height), dpi=dpi, tight_layout=True)
        axes = figure.add_subplot(121)

        super(LCAProcessContributionPlot, self).__init__(figure)
        self.setParent(parent)

        method = 0  # TODO let user choose the LCIA method
        tc = mlca.top_process_contributions(method=method, limit=5, relative=True)
        df_tc = pd.DataFrame(tc)
        df_tc.columns = [format_activity_label(a) for a in tc.keys()]
        df_tc.index = [format_activity_label(a, style='pl') for a in df_tc.index]
        plot = df_tc.T.plot.barh(
            stacked=True,
            figsize=(6, 6),
            cmap=plt.cm.nipy_spectral_r,
            ax=axes
        )
        plot.tick_params(labelsize=8)
        axes.legend(loc='center left', bbox_to_anchor=(1, 0.5))
        plt.rc('legend', **{'fontsize': 8})
        self.setMinimumSize(self.size())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号