For a couple of month I was able to export jupyter notebooks which include ipywidgets and plotly figures to html. Everything was working as expected. But yestersday I opened one of these HTML files and the widgets don’t show figures. In the javascript console there is an error “jupyterlab-plotly.js not found”, but I am not sure if this is the origin of the problem. Generating new html files does not work either. Same result on different computers. Any ideas what has happened?
Sample code:
import pandas as pd
import plotly.graph_objects as go
import ipywidgets as widgets
from IPython.display import Markdown
s = pd.Series(index=[1, 2, 3, 4, 5], data=[0, 1, 2, 4, 9])
Markdown('# Figure')
fig = go.Figure()
trace = go.Scatter(x=s.index, y=s.values, mode='lines')
fig.add_trace(trace)
fig.show()
Markdown('# FigureWidget')
_fig = go.FigureWidget(fig)
_fig.show()
Markdown('# widgets.HBox')
widgets.HBox([go.FigureWidget(fig)])
Markdown('# widgets.Tab')
widgets.Tab([go.FigureWidget(fig)])
Markdown('# The end')
Conversion to HTML:
jupyter nbconvert --no-input --execute plotly_check.ipynb --to html
The first two figures appear, the others don’t.