Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
371 views
in Technique[技术] by (71.8m points)

python - plotly-dash not working in Jupyterlab and plotly extension not working either

I am trying to display a figure created with plotly.graph_objects.Scatterpolar.

import plotly.graph_objects as go

fig = go.Figure()

fig.add_trace(go.Scatterpolar(
      r=[0,1,0.1,0.5,0.8,0],
      theta=["var1","var2", "var3", "var4","var5", "var1"],
      fill=None,
      line_color = "red",
      name='ITT'
))
fig.show()

But when I run it I only get a white space. I am following this guide(https://plotly.com/python/getting-started/), I try to install the extension

jupyter labextension install [email protected]

using the extension manager but I can't find it. Is there another way of installing this extension? Or another way to solve the problem of the plotly figure not displaying?

Thank you!

question from:https://stackoverflow.com/questions/65861325/plotly-dash-not-working-in-jupyterlab-and-plotly-extension-not-working-either

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This code works fine for me in jupyter notebook. So lets first try running the following in a terminal

pip install "notebook>=5.3" "ipywidgets>=7.5"

Then reopen jupyter notebooks. And try running a new cell with only the following

pip install plotly

then in another separate cell run only

import plotly.graph_objects as go

and then run the rest of the code in its own cell, given you don't get any errors.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...