Blank figure in jupyterlab


I tried to run a simple plotly example code in a jupyterlab and I keep getting a blank object.

import plotly.graph_objects as go
fig = go.Figure(data=go.Bar(y=[2, 3, 1]))

btw, when I execute “fig.write_html(‘first_figure.html’, auto_open=True)” the plot shows up correctly in a separate browser window!
But of course I would like to have the plot in the jupyterlab.

What can I do here?

Thanks and best regards,

jupyterlab 1.2.6
nodejs 12.16.1
plotly 4.5.2
ipywidgets 7.5.1

jupyter-voila/jupyterlab-preview v0.1.3 enabled ok
jupyter-widgets/jupyterlab-manager v1.1.0 enabled ok
jupyterlab/plotly-extension v1.0.0 enabled ok
jupyterlab-dash v0.1.0-alpha.3 enabled ok
jupyterlab-plotly v1.5.2 enabled ok
plotlywidget v1.5.2 enabled ok

Hi @foraly, could you please try to remove the jupyterlab/plotly-extension which is deprecated? There might be a conflict here… If this does not work, can you please open the console of your browser to see if any error messages are displayed when a blank figure is rendered?

Thanks @Emmanuelle for the quick response! :slight_smile:

I just followed your advice and uninstalled the jupyterlab/plotly-extension.
I closed and opened the jupyterlab, but the situation is unchanged.

Now I run “jupyter lab build” which normally takes forever… I will tell you if there is an improvemet…

Unfortunately the “jupyter lab build” didn’t change anything neither.
I still have the blank figures.

:frowning: How about messages in the console? (Open the developer tools of your browser to see the console)

There are a lot of warnings that I do not understand. :grimacing:

Nevertheless, the jupyterlab in general seems to work fine. Even plotting with “FigureWidgets” is working.




ok… and this happens with every figure you try to render, I guess? (Have you tried different types of traces, just for the sake of debugging?)

Well, I tried some basic examples like e.g. the one from getting started.

Do you have a particular example of a trace that I could try to debug?

Thanks Emmanuelle!

Here is another example that I tried. Still blank.

from plotly.offline import init_notebook_mode, iplot
import plotly.graph_objs as go


data = [
x=[1, 2, 3],
y=[1, 3, 1]

config = {‘linkText’: “Let’s visit !!!”}
iplot(data, config=config)

Everytime i’ve had this problem it has had to do with the plotly extension. just to be sure try

jupyter lab clean


jupyter lab build

. use jupyter’s in-built menu to install/uninstall the extension.