If I create a plotly express figure like so:
fig = px.line(data, color_discrete_map={"Gold": "gold","Silver": "silver"})
,
it works fine.
But if I want to update the colors after the figure is created, like so:
fig = px.line(data)
fig.update_layout(color_discrete_map={"Gold": "gold", "Silver": "silver"})
I get
AttributeError: 'Figure' object has no attribute 'color'
I have also tried with update_traces()
with no success.
What is the correct way to do this please?