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

Viewed 721

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 jupyterlab-plotly@4.14.3

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!

1 Answers

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.

Related