Here’s my code from a Jupyter Notebook (note–not JupyterLab):
!/opt/app-root/miniconda3/bin/jupyter nbextension enable --py --user widgetsnbextension
# import numpy as np; import pandas as pd
import plotly.graph_objects as go
from ipywidgets import widgets
reset_button = widgets.Button(
description='Reset', disabled=False,
button_style='')
# reset_button shows a button here
fig = go.Figure()
fig.add_bar(x=['giraffes', 'orangutans', 'monkeys'], y=[20, 14, 23],
hoverinfo="text", showlegend=False,
marker=dict(color="crimson", opacity=0.8))
# fig shows a bar chart here
widgets.HBox([reset_button, go.FigureWidget(fig)])
I expect that the HBox widget would display the reset button adjacent to the bar chart plot. What do I need to do to make widgets and plots active in the same bounded space?
This worked fine for me in Plotly version 4. Have things changed that much in version 5?