Group by color in px.timeline

Hi,
how does one create the grouping in px.timeline?
Let’s say I have a dataframe and I want column “Task” on y-axis and I want to color it with “Root Domain” column. But I also want the grouping in y-axis given by the colors as presented in the image. So far I only have

fig = px.timeline(df, x_start="Start", x_end="Finish", y="Task", color="Root Domain")
fig.show()

Thanks for you advices!
Ondra

1 Like

I’m trying to figure out the same. I assume it’s done using this barmode=‘group’, but I haven’t implemented it yet for a timeline. https://plotly.com/python/bar-charts/#grouped-bar-chart Did you ever manage to do it?

Easier than expected!

fig = px.timeline(df, x_start=“Start”, x_end=“Finish”, y=“Task”, color=“Key”, color=“Rood Domain”)
fig.update_layout(barmode=‘group’)
fig.show()