[Python] Plotly legend title

Discussão em 'Python' iniciado por Stack, Março 5, 2025.

  1. Stack

    Stack Membro Participativo

    I'd like to be able to add a title to the legend, in the following code. However, looking at the docs, I don't think there is a method for this.

    import plotly.plotly as py
    import plotly.graph_objs as go

    trace0 = go.Scatter(
    x=[1, 2, 3, 4, 5],
    y=[1, 2, 3, 4, 5],
    )

    trace1 = go.Scatter(
    x=[1, 2, 3, 4, 5],
    y=[5, 4, 3, 2, 1],
    )

    data = [trace0, trace1]
    fig = go.Figure(data=data)

    py.iplot(fig, filename='default-legend')

    Continue reading...

Compartilhe esta Página