0

I have a weird problem. Jupyterlab doesn't show plotly graphs, but in Jupyter notebook, everything works fine. I've searched everywhere, many said plotly-extension should be installed. I have installed plotly extension. The notebook I'm working on is trusted. I don't know what should I do.

import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Scatter(y=[2, 1, 4, 3]))
fig.add_trace(go.Bar(y=[1, 4, 3, 2]))
fig.update_layout(title = 'Hello Figure')
fig.show()

This is what jupyterlab shows me

Gonçalo Peres
  • 11,752
  • 3
  • 54
  • 83
  • You can check [here](https://plotly.com/python/getting-started/#jupyterlab-support-python-35) for the extensions that need to be installed. Additionally you need to install [node](https://nodejs.org/). – Kaymal Jun 26 '20 at 22:06
  • You can use lower level plotly and call `iplot` to show the figure. `from plotly.offline import iplot`. Then `iplot(fig)`. – S3DEV Aug 18 '20 at 18:01

1 Answers1

1

Just had the same problem and, as I am using Anaconda, in the "Server" environment, apart from installing Plotly, I installed the following JupyterLab extension(s):

  • jupyterlab-plotly

    jupyter labextension install jupyterlab-plotly@4.14.1
    
  • plotlywidget [optional]

    jupyter labextension install @jupyter-widgets/jupyterlab-manager plotlywidget@4.14.1
    

In order to install the extensions nodejs is required.

For a more detailed answer check my answer here.

Gonçalo Peres
  • 11,752
  • 3
  • 54
  • 83