Plotly Mapbox not updating on selectbox change

When the user changes the selectbox option, the scatter mapbox dots do not update properly. They are there but invisible (you can mouse over and see the hover_data). If the user clicks full screen the map seems to refresh and the dots display properly.

selected_project = st.selectbox(label="**Select a Project:**", options=distinct_equipment_df['PROJECT'].unique())
project_lat_longs = distinct_equipment_df[distinct_equipment_df['PROJECT'] == selected_project]    
# Plot map for a selected project
fig = px.scatter_mapbox(project_lat_longs, lat="LATITUDE", lon="LONGITUDE", 
                    color="EQUIPMENT_TYPE", hover_name='LOCATION_ID',
                    hover_data =['STATUS', 'LATITUDE', 'LONGITUDE'],
                    color_discrete_sequence=px.colors.qualitative.G10, size_max=20, zoom=6,
        margin=dict(l=0, r=0, t=0, b=0))
st.plotly_chart(fig, use_container_width=True)
1 Like

This does indeed seem to be a bug – probably another instance of this issue that was recently reported plotly_chart using cached data on axis · Issue #5902 · streamlit/streamlit · GitHub

Feel free to upvote that issue, and add your example if you’d like, but hopefully we’ll have a fix for this soon.


I found the same limitations, had to switch to pydeck and keplergl