You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi it's me again :D
This issue is closely related to this one as I believe it originates from streamlit-plotly-events.
The same kind of issue can be recreated with streamlit-plotly-mapbox-events :
import streamlit as st
import numpy as np
from streamlit_plotly_mapbox_events import plotly_mapbox_events
import plotly.express as px
np.random.seed(1312)
# Initialize zoom and center variables in session state
if "zoom" not in st.session_state:
st.session_state.zoom = 3
if "center" not in st.session_state:
st.session_state.center = {"lat": 0, "lon": 0}
x = np.linspace(-5, 5, 50) + np.random.normal(loc=0, scale=0.1, size=50)
y = np.linspace(-5, 5, 50) + np.random.normal(loc=0, scale=0.1, size=50)
a = st.number_input("Left crop", value=0)
b = st.number_input("Right crop", value=len(x))
fig = px.scatter_mapbox(lat=x[a:b], lon=y[a:b], mapbox_style="open-street-map", zoom=st.session_state.zoom, center=st.session_state.center)
# Plotly express version
st.plotly_chart(fig)
# Plotly events version
plotly_mapbox_events(fig)
# Update zoom and center values in session state
st.session_state.zoom = fig.layout.mapbox.zoom
st.session_state.center = fig.layout.mapbox.center
I don't know if I can realistically expect a smooth update of the map as with native plotly, but I'm hoping you can make it happen 🙏
Thank you once again!
The text was updated successfully, but these errors were encountered:
Hi it's me again :D
This issue is closely related to this one as I believe it originates from streamlit-plotly-events.
The same kind of issue can be recreated with streamlit-plotly-mapbox-events :
I don't know if I can realistically expect a smooth update of the map as with native plotly, but I'm hoping you can make it happen 🙏
Thank you once again!
The text was updated successfully, but these errors were encountered: