FigureWidget() with subplots and legends positioned on/next to subplots


I am creating my first Plotly FigureWidget but have some troubles getting the legends of its subplots correctly positioned.
The legends get all listed up on the right side of the FigureWidget (see below).

What I would like is that the legends appear on the respective subplots or just next to them.

The structure of my code is as follows:

subplots = make_subplots(rows=4, cols=5, specs=…)
f = go.FigureWidget(subplots)

fig1_Pp = go.Scatter(…)
f.add_trace(fig1_Pp, …)

vb = HBox([slider, f])

I tried the a method using ‘legendgroups’ explained here but it didn’t work. I am not quite sure why.

Thanks for your help in advance,

1 Like

I found a way how to solve my question above by creating several FigureWidgets:

f1 = go.FigureWidget(subplots1)

fn = go.FigureWidget(subplotsn)

Then I integrate them into a HBox which then places the legends right next to the respective figures.
vb = HBox([slider, f1, …, fn])