Hello Everyone,
I am trying to make an area plot without lines and setting the category colours. I can make the plot and set the colours. However, the colours are reset to the default colours when the I update the trace to remove the lines, i.e. setting the mode=βnoneβ.
Is there a way to do this without resetting the colours? I am new to plotly and I am likely updating the trace incorrectly but I have not found any relevant examples yet, so any help will be greatly appreciated.
Here is the code to reproduce the problem:
import sys
import pandas as pd
import plotly.express as px
Iris = px.data.iris()
fig = px.area(Iris, x='petal_width', y='species_id', color='species', color_discrete_map={"setosa": "#6666ff", "versicolor": "#fd66ff", "virginica": "#ffff0a"})
which produces the following plot:
When I update the trace with the following code:
fig.update_traces(mode='none')
The plot becomes:
How can I remove the lines and keep the defined colours?
Thanks in advance for any help or pointers.