I have a moderate sized data set of x-y scatter objects that I have placed into groups and sets. Plotting using facet_row, facet_col was starting to make for tiny little subplots due to the large number of facet_rows. I wanted to try animating the data to get a slider make it easier to visualize. The issue is the slider reaches a point where plots stop updating. To illustrate I have defined a simple data set:
data = {
'x':[ 0, 1, 2, 0, 1, 2],
'y':[ 0, 1, 4, .5, 1.5, 18],
'g':['A','A','A','B','B','B'],
's':[ 10, 10, 10, 20, 20, 20]
}
data = pd.DataFrame(data)
fig = px.scatter(data, x=βxβ, y=βyβ, facet_col=βgβ, animation_frame=βsβ)
fig.show()
The above will give you a slider that uses the βsβ column but when you pull it to 20 and back to 10 the group βAβ scatter trace is just gone. If I skip trying to animate and use facet_row=βsβ then I get the plot I expect but this approach doesnβt scale will for many different values of s.
fig = px.scatter(data, x='x', y='y', facet_col='g', facet_row='s')
fig.show()
If I pad the data to force both βAβ and βBβ groups to have a least a single NaN for sets 10,20 then the animation appears to work but I would rather not have manually force data points in. I really like the terse compact syntax for adding the animation and would like to use this approach if possible.