Plotly 在 AWS Sagemaker JupyterLab 中显示空白图表

Sid*_*Sid 10 machine-learning plotly jupyter-lab amazon-sagemaker plotly-python

背景:我是 Python 世界的新手,正在使用 Plotly 在 Python 中创建基本图形。我使用 AWS Sagemaker 的 JupyterLab 来创建 python 脚本。

问题:我一直在尝试运行 Plotly 网站上提到的基本代码,但即使这些代码也返回空白图表。

我自己尝试的问题解决:

  1. pip安装plotly版本4.6.0

  2. https://plotly.com/python/getting-started/上提到的 JupyterLab 支持步骤已经执行

代码示例:

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

rpa*_*nai 1

我认为文档不符合标准。您现在需要安装jupyterlab-plotly扩展。

jupyter labextension install jupyterlab-plotly
Run Code Online (Sandbox Code Playgroud)

更新我遵循了此处此处 的混合说明。

首先从 jupyter-lab 启用扩展管理器,然后从终端启用

conda  install -c conda-forge "nbformat" "ipywidgets>=7.5" -y

jupyter labextension install jupyterlab-plotly
jupyter labextension install @jupyter-widgets/jupyterlab-manager plotlywidget
Run Code Online (Sandbox Code Playgroud)

在您的环境中

conda install nbformat
Run Code Online (Sandbox Code Playgroud)