Bars missing on animation for stacked bar plots

Hi @cpx10 ,

It seems there is problem when use animation_group=“qty”, because there is same “qty” value on indicator 2 and indicator 4. So the bar on indicator 4 is disappeared.

If you want to keep detail distribution on each bar, you can use animation_group=df.index instead of animation_group="qty".

The code with animation will be like this:

px.bar(df, x="indicator", y="qty", animation_frame="time", animation_group=df.index,
        range_y=[0, df.groupby(["time", "indicator"])["qty"].sum().max()+20])

output:

I hope this help.

1 Like