下面的示例生成了一个可以用jupyter notebook
显示的动画图形,但是在jupyter-lab
中该图形没有显示。
%pylab inline
import plotly.express as px
gapminder = px.data.gapminder()
px.scatter(gapminder, x="gdpPercap", y="lifeExp", animation_frame="year", animation_group="country",
size="pop", color="continent", hover_name="country",
log_x=True, size_max=55, range_x=[100,100000], range_y=[25,90])
使用plotly 4.0.0和plotly_express 0.4.0。
任何想法可能出什么问题吗?
答案 0 :(得分:2)
按照以下步骤在 jupyter notebook 中显示绘图,请按照以下链接查找有关以下命令及其用法的更多详细信息: JupyterLab Support for plotely
pip install jupyterlab "ipywidgets>=7.5"
jupyter labextension install jupyterlab-plotly@4.14.3
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter lab
答案 1 :(得分:1)
要获得JupyterLab支持,还有几个附加的安装步骤:https://plot.ly/python/getting-started/#jupyterlab-support-python-35
答案 2 :(得分:0)
这是因为 Nbextension。在可配置的 nbextensions 中。您必须禁用 jupyterlab-plotly/extension
和 plotlywidget/extension
。之后重新启动笔记本。我希望它会奏效。here is image of disable