I’m having a lot of trouble creating a grouped and stacked bar chart at the same time. I’ve seen some forum posts discussing this issue, but I haven’t been successful in applying the solutions to my code.
I want the bottom part of the chart (in green) to be plotted alongside the colored bars. Is it possible to do this?
My code:
colors = {}
for i, title in enumerate(df_tickets_group['tik_title'].unique()):
colors[title] = px.colors.qualitative.Alphabet[i % len(px.colors.qualitative.Alphabet)]
for title, color in colors.items():
df_filtered = df_tickets_group[df_tickets_group['tik_title'] == title]
fig.add_trace(go.Bar(
x=df_filtered['tik_create_at'],
y=df_filtered['index'],
name=title,
marker=dict(color=color),
yaxis = 'y1',
text=round(df_filtered['index'])
))
fig.add_trace(go.Bar(
x=df_tickets_historic_group['tik_create_at'],
y=df_tickets_historic_group['index'],
name='Historico',
marker=dict(color=px.colors.qualitative.Bold[1]),
yaxis='y2',
text=round(df_tickets_historic_group['index'])
))
I appreciate all the help!