Monday, 10 May 2021

Plotly - update subplot titles after traces where createtd

I have a plotly plot composed of subplots -

fig = make_subplots(
        rows=3, cols=1)

fig.add_trace(go.Scatter(x=[1, 2, 3], y=[4, 5, 6]), row=1, col=1)
fig.add_trace(go.Scatter(x=[1, 2, 3], y=[4, 5, 6]), row=2, col=1)
fig.add_trace(go.Scatter(x=[1, 2, 3], y=[4, 5, 6]), row=3, col=1)

I was to add a title for every the subplots but only after the figure is created and the traces are added. I.e not when I create the figure -

fig = make_subplots(
            rows=3, cols=1, subplot_titles=['a', 'b', 'c']

Can I do it via fig.update_layout or something similar?



from Plotly - update subplot titles after traces where createtd

No comments:

Post a Comment