profile_plotter.py 文件源码

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

项目:yt 作者: yt-project 项目源码 文件源码
def _repr_html_(self):
        """Return an html representation of the plot object. Will display as a
        png for each WindowPlotMPL instance in self.plots"""
        ret = ''
        unique = set(self.plots.values())
        if len(unique) < len(self.plots):
            iters = izip(range(len(unique)), sorted(unique))
        else:
            iters = iteritems(self.plots)
        for uid, plot in iters:
            with matplotlib_style_context():
                img = plot._repr_png_()
            img = base64.b64encode(img).decode()
            ret += r'<img style="max-width:100%%;max-height:100%%;" ' \
                   r'src="data:image/png;base64,{0}"><br>'.format(img)
        return ret
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号