剧情基本示例显示在jupyter实验室中没有剧情 [英] plotly basic example shows no plot in jupyter lab

查看:113
本文介绍了剧情基本示例显示在jupyter实验室中没有剧情的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚尝试在jupyter笔记本中使用密谋离线(使用jupyter实验室). 文档给出了以下示例:

I just tried to use plotly offline in a jupyter notebook (using jupyter lab). The docs gives this example:

import plotly
import plotly.graph_objs as go

plotly.offline.init_notebook_mode(connected=True)

plotly.offline.iplot({
    "data": [go.Scatter(x=[1, 2, 3, 4], y=[4, 3, 2, 1])],
    "layout": go.Layout(title="hello world")
})

我尝试过,在Edge或Firefox中都没有显示图表.
笔记本中有一个输出单元,但没有图表.

I tried it and there is no chart displayed, either in Edge or Firefox.
An output cell is made in the notebook, but there is no chart.

如果我使用plotly.offline.plot而不是iplot,它就可以工作.如果我使用传统的Jupyter笔记本而不是Jupyter Lab,它会起作用.

It works if I use plotly.offline.plot rather than iplot. It works if I use the traditional jupyter notebook rather than jupyter lab.

为什么不显示任何想法?

Any ideas why it does not display?

它是2.7.0版.

推荐答案

您是否已安装Plotly JupyterLab扩展程序?如果没有它,它将无法内联工作.您可以在此处获取它: https://github.com/jupyterlab/jupyter-renderers/tree/master/packages/plotly-extension

Have you installed Plotly JupyterLab extension? It will not work inline without it. You can get it here: https://github.com/jupyterlab/jupyter-renderers/tree/master/packages/plotly-extension

或仅通过终端jupyter labextension install @jupyterlab/plotly-extension

这篇关于剧情基本示例显示在jupyter实验室中没有剧情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆