sankey_widget.py 文件源码

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

项目:ipysankeywidget 作者: ricklupton 项目源码 文件源码
def save_png(self, filename):
        """Save the diagram to a PNG file.

        The widget must be displayed first before the PNG data is available. To
        display the widget and save an image at the same time, use
        `auto_save_png`.

        Parameters
        ----------
        filename : string
        """
        if self.png:
            data = base64.decodebytes(bytes(self.png, 'ascii'))
            with open(filename, 'wb') as f:
                f.write(data)
        else:
            warnings.warn('No png image available! Try auto_save_png() instead?')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号