Plotly Express - How to remove unwanted line after update?

I am trying to create a graph of sales using px.line. I create an initial plot and then repeatedly update the same one with forecasted data. The issue is that once I make the update, the line that was part of the previous forecast seems to remain although it doesn't point to any real data.

Couldn't figure out what to search for online. Is there a way to maybe reset the graph each time before plotting?

Relative beginner in this, Any help is appreciated.

app.layout = html.Div(children=[
            dcc.Graph(
                id='test',)])

fig = px.line(yy , x='month', y="qty",
              color='year',
              text='qty',
              custom_data=['year'],
             )
    fig.update_layout(hovermode='x unified')
    fig.update_traces(
    hovertemplate="<br>".join([
        "qty: %{y}",
    ])

-before Before

-after After



Comments

Popular posts from this blog

I get wrong characters when retreiving the message body of an email using TIdIMAP4.UIDRetrieveTextPeek2()

How to drop the all the 1's in a correlation matrix

Today Walkin 14th-Sept