✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Animation_group + how to control different traces using uid parameter

hello,

I am trying to create a plotly animation using px.scatter_mapbox for lat/lon data, and have clustering means that I would like to plot as “traces”…so far I have the following:

fig = px.scatter_mapbox(result, lat=“Lat”, lon=“Lon”, animation_frame = ‘Year’,
animation_group = ‘Trace_Constant’, color_discrete_sequence=[“fuchsia”], zoom = 8, height=500)
fig.update_layout(mapbox_style=“open-street-map”)
fig.update_layout(margin={“r”:0,“t”:0,“l”:0,“b”:0})

fig.add_trace(go.Scattermapbox(lat=means[:,0],
lon=means[:,1],
marker=go.scattermapbox.Marker(size=10,color=‘rgb(255, 255, 255)’,opacity=1 ),
uid=15))

The issue:
As you see, I have this uid in the trace which is supposed to “provide object constancy between traces during animations and transitions” (documentation).

But, this uid along with the animation group that contains the uid value and other values, does not produce intended results of the animation having different traces for different years.

Thanks!