[Python] Plotly: How to apply different titles for each different subplots?

Discussão em 'Python' iniciado por Stack, Setembro 30, 2024.

  1. Stack

    Stack Membro Participativo

    Given that i have the below code from this link:

    from plotly.subplots import make_subplots
    import plotly.graph_objects as go

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

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

    fig.add_trace(
    go.Scatter(x=[20, 30, 40], y=[50, 60, 70]),
    row=1, col=2
    )

    fig.update_layout(height=600, width=800, title_text="Subplots")
    fig.show()


    The problem in this code is, the xaxis and yaxis does not have any label. Beside this, the current code applies only one title to all the plots, however I want to apply different titles to each scatter plot.

    How can i do that?

    Continue reading...

Compartilhe esta Página