plotly.offline.iplot gives a large blank field as its output in Jupyter Notebook/Lab

前端 未结 8 1604
粉色の甜心
粉色の甜心 2020-12-17 09:17

I am trying to create a Sankey chart in a Jupyter notebook, basing my code on the first example shown here.

I ended up with this, which I can run without getting any

8条回答
  •  醉酒成梦
    2020-12-17 09:28

    When using Google Colab, include the snippet -

    import plotly.io as pio
    pio.renderers.default = 'colab'
    

    Or use the overall import statements as -

    import plotly.offline as py
    py.init_notebook_mode(connected=True)
    import plotly.graph_objs as go
    import plotly.io as pio
    pio.renderers.default = 'colab'
    from plotly.offline import init_notebook_mode, iplot
    

    This will set the rendering to Colab style and the plots will be displayed.

    Hope this helps.

提交回复
热议问题