Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Exporting Jupyterlab notebook as HTML plotly loses interactiveness

Hi everyone, I’m having a problem when I export my notebook in Jupyterlab to HTML my plots I generated from plotly lose the interactive aspect. I have been able to export before and plotly stays interactive.

I’m using plotly 3.4.0 and jupyter labextension @jupyterlab/plotly-extension v0.18.0

Code:
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import plotly.offline as po

fig = go.Figure(data=data, layout=layout)
interactive = iplot(fig)

Has anyone come across this before?

Hi @tmiesse,

Try running init_notebook_mode() before calling iplot. init_notebook_mode isn’t needed for JupyterLab to render the graphs, but it is still needed to export them as interactive plots to HTML.

Hope that helps!
-Jon

Yes that worked perfectly.

I thought I tried using init_notebook_node() the other day on a different computer and it ended up giving blank outputs, but it works now.

Thank you

1 Like