moment = ['average lag','median lag']
web_df.reset_index(inplace=True)
for i in range(len(moment)):
web_df[moment[i]] = pd.to_datetime(web_df[moment[i]].astype(str))
web_df[moment[i]] = 60*60*web_df[moment[i]].dt.hour+60*web_df[moment[i]].dt.minute+web_df[moment[i]].dt.second
web_df = web_df.dropna()
fig = make_subplots(rows=2,cols=1,specs=[[{'type':'mapbox'}],[{'type':'mapbox'}]])
fig.append_trace(px.scatter_mapbox(web_df, lat="latitude", lon="longitude",animation_frame='hour_of_day', animation_group = 'state',hover_name='station_id',hover_data = [moment[0]],
size=moment[0],zoom=5.8, height=1000,center={'lat':3.9457,'lon':108.1429}).data[0],row=1,col=1)
fig.append_trace(px.scatter_mapbox(web_df, lat="latitude", lon="longitude",animation_frame='hour_of_day', animation_group = 'state',hover_name='station_id',hover_data = [moment[1]],
size=moment[1],zoom=5.8, height=1000,center={'lat':3.9457,'lon':108.1429}).data[0],row=2,col=1)
fig.update_mapboxes(style='open-street-map')
fig.update_layout(mapbox_style="open-street-map")
Hi everyone, with the code above, I could obtain the plot as shown in this diagram
There are several issues with it:
a) It did not preserve the zoom and center of the map
b) It also did not preserve the sliders that i initialized via animation_frame
I would appreciate any help in fixing these issues. Thanks so much