I’m creating a bar chart to show changes in a min/max over time. The idea being that for each product along the x-axis, there are two bars: one for a previous date and one for the latest date, with the base as the minimum and the top of the bar being the maximum. The problem is the bars are not centred to the product along the x-axis and the bars overlap.
This is the code which creates the figure as part of a callback:
fig = go.Figure() for index, row in df.iterrows(): fig.add_trace(go.Bar(x=[row.Process[25:]], y=[row.Max-row.Min], base=row.Min, name=str(date), marker_color='red', width=0.2)) fig.add_trace(go.Bar(x=[row.Process[25:]], y=[row.Max2-row.Min2], base=row.Min2, name=str(edate), marker_color='green', width=0.2)) fig.update_layout(barmode='group', showlegend=False, autosize=True)
and this is the figure it currently returns:
Hopefully you can see the problems I’ve outlined above. I’ve used barmode=‘group’ but this doesn’t seem to be recognised.
Any help appreciated, thanks!