plotly.py 文件源码

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

项目:lddmm-ot 作者: jeanfeydy 项目源码 文件源码
def ishow(cls, figure_or_data, format='png', width=None, height=None,
              scale=None):
        """Display a static image of the plot described by `figure_or_data`
        in an IPython Notebook.

        positional arguments:
        - figure_or_data: The figure dict-like or data list-like object that
                          describes a plotly figure.
                          Same argument used in `py.plot`, `py.iplot`,
                          see https://plot.ly/python for examples
        - format: 'png', 'svg', 'jpeg', 'pdf'
        - width: output width
        - height: output height
        - scale: Increase the resolution of the image by `scale` amount
               Only valid for PNG and JPEG images.

        example:
import plotly.plotly as py
    fig = {'data': [{'x': [1, 2, 3], 'y': [3, 1, 5], 'type': 'bar'}]}
    py.image.ishow(fig, 'png', scale=3)
    """
    if format == 'pdf':
        raise exceptions.PlotlyError(
            "Aw, snap! "
            "It's not currently possible to embed a pdf into "
            "an IPython notebook. You can save the pdf "
            "with the `image.save_as` or you can "
            "embed an png, jpeg, or svg.")
    img = cls.get(figure_or_data, format, width, height, scale)
    from IPython.display import display, Image, SVG
    if format == 'svg':
        display(SVG(img))
    else:
        display(Image(img))

```

评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号