✊🏿 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!

Can't seem to get legendgrouptitle to work

I am trying to implement the new 5.1.0 plotly legendgrouptitle but cannot seem to get it to work. I am doing something similar to this:

fig = make_subplots(
    rows=4,
    cols=1,
    shared_xaxes=True,
    specs=[[{"secondary_y": True}], [{"secondary_y": True}], [{"secondary_y": True}], [{"secondary_y": True}]]
)
legend_groups = [1,2,3,4]
for legend_group in legend_groups:
    fig.add_trace(
        go.Scatter(
            x=df['<some timestamp data>'],
            y=df['<some data>']
            name='<some name>',
            legendgroup=legend_group,
            legendgrouptitle=dict(text=legend_group)
        ),
        secondary_y=False,
        row=legend_group,
        col=1
    )
    fig.add_trace(
        go.Bar(
            x=df['<some timestamp data>'],
            y=df['<some data>']
            name='<some name>',
            legendgroup=legend_group,
        ),
        secondary_y=True,
        row=legend_group,
        col=1
    )

I think possibly it could be because I am using a subplot as my figure or also because I am using secondary_y axes but I have no real idea. My confusion stems from the fact that the legend groups work correctly because the traces are grouped accordingly, but their titles fail to appear.