Hello,
I am trying to animate stacked bar charts (px.bar()) but Iβm running into inconsistencies when using the animation_frame and animation_group arguments.
Example on just 1 frame (1 time value), but I would like to generalize that for several frames:
import pandas as pd
data = [
["08:00:00", 10, 1, "1"],
["08:00:00", 70, 2, "1"],
["08:00:00", 20, 2, "1"],
["08:00:00", 20, 4, "2"],
["08:00:00", 30, 5, "2"],
["08:00:00", 50, 5, "2"],
]
df = pd.DataFrame(data=data, columns=["time", "qty", "indicator", "source"])
No animation:
px.bar(df, x="indicator", y="qty", range_y=[0, df.groupby(["time", "indicator"])["qty"].sum().max()])
out:
With animation:
px.bar(df, x="indicator", y="qty", animation_frame="time", animation_group="qty",
range_y=[0, df.groupby(["time", "indicator"])["qty"].sum().max()])
out:
As you can see, the bar on indicator=4 is missing although and weirdly enough, the data seems to be there when I hover on the space.
Note that I use animation_group=βqtyβ instead of animation_group=βindicatorβ since I want to keep the detailed distribution on each bar.
Am I missing something or is this a known bug?
Thanks a lot