I found a workaround. The issue is interesting, because hoverdata exists. So, although you don’t see the points, when I enable hoverinfo I do see the data when hovering over the points that disappear.
My workaround:
create two figures. One for the persistent data (i.e. scattergl with all the points) and one separately for the animated shape. So a dcc.Graph with the base-figure, and one with overlay-figure. Just make sure the layout is the same.
To overlay them on eachother, some css is needed. Mainly: dcc.Graph must have css styling with positions set to absolute. zIndex is to control ordering. Secondly, the parent container should have position set to relative. In my example below, I use dash bootstrap column.
dbc.Col(
id='fig-div',
children=[
dcc.Graph(
id='base-figure',
figure=base_fig,
responsive=True,
style={
"width": "100%",
"height": "100%",
'position': 'absolute', # must be absolute
'zIndex': 1 # controls layer its drawn on
},
config=DCC_GRAPH_CONFIG,
),
dcc.Graph(
id='overlay-figure',
figure=overlay_fig,
responsive=True,
style={
"width": "100%",
"height": "100%",
'position': 'absolute',
'zIndex': 2
},
config={
'displayModeBar': False,
'editable': False,
'edits': {
'shapePosition': True,
}
},
)
],
# This is the parent-style of the dcc which must have positions relative
style={'position': 'relative'}
)
Additional notes that might have some effects: when creating the base_fig I used scattergl, therefore, when creating the overlay_fig, i created the initial figure with an empty scattergl.