I implemented a Timeline to display my data. To create the Timeline I used:
fig = px.timeline(df
, x_start="Start"
, x_end="End"
, y="Name"
, hover_name="Task"
, opacity=0.8
, template='plotly_white'
, height=len(df)*35
, width=1150
, color="Type"
, category_orders=dict(
Name=df["Name"].drop_duplicates().tolist()
)
)
You can see that the colors are based on "Type". In my dataframe I have two types of Data: Releases and Epics. The colors look like follows:
The problem here is that colors are generated randomly. However, I would like to define the colors like this:
colors = {'Release':'rgb(255,239,0)', 'Epic':'rgb(148, 76, 228)'}
fig.update(color=colors)
Is there a way to do this?


color_*parameters oftimelinesuch ascolor_discrete_sequenceorcolor_discrete_map? plotly.com/python-api-reference/generated/…