✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Ipywidgets Tab & FigureWidget inconsistent sizing

In JupyterLab, when putting go.FigureWidget objects into tabs of ipywidgets.Tab, the figure in the first tab automatically spans the whole tab area, but figures in other tabs don’t, even if the same figure.

This happens only in JupyterLab and not in JupyterNotebook (where no figure automatically resizes).

Code to reproduce:

import ipywidgets as widgets
import plotly.graph_objects as go

fig = go.FigureWidget(data=go.Bar(y=[2, 3, 1]))
tab = widgets.Tab([fig, fig, fig])
tab

I’m not sure if that comes from JupyterLab or from plotly though.