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

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)