绘制图不会在安装了零到JupyterHubGKE的JupyterLab上呈现

问题描述

我试图在JupyterLab上渲染Plotly图,并将其安装到GKE上的JupyterHub上为零。我在这里关注了文档:

https://plotly.com/python/getting-started/

但是,图形仍然不能直接在JupyterLab上呈现。还有其他我想念的东西吗?

感谢您的帮助!

解决方法

找到答案后,您实际上必须在该过程中再添加几个步骤。这是完整的:

  1. 按图安装pip install plotly==4.9.0
  2. 安装/升级Jupyterlab小部件pip install jupyterlab "ipywidgets>=7.5"
  3. 安装jupyterlab扩展jupyter labextension install jupyterlab-plotly@4.9.0
  4. 可选jupyter labextension install @jupyter-widgets/jupyterlab-manager plotlywidget@4.9.0
  5. 可选,检查安装的扩展程序jupyter labextension list
  6. 刷新jupyterlab的页面
  7. 通过运行jupyter lab build
  8. 构建映像

现在您可以打开笔记本并运行一些示例绘图代码:

import plotly.graph_objects as go
fig = go.Figure(data=go.Bar(y=[2,3,1]))
fig.show()

您应该看到图形出现;)

,

一个似乎可行的简单解决方案是:

import plotly.graph_objects as go

fig = go.Figure(data=go.Bar(y=[2,1]))

fig.show(renderer="iframe")

它看起来也很好

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...