Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chart reloading entirely upon changing data #12

Open
HugoAndre276 opened this issue Mar 21, 2024 · 0 comments
Open

Chart reloading entirely upon changing data #12

HugoAndre276 opened this issue Mar 21, 2024 · 0 comments

Comments

@HugoAndre276
Copy link

HugoAndre276 commented Mar 21, 2024

Hi!
I've been using your module via reyemb's mapbox project project and I've started to realise the reloading of data isn't consistent with plotly's native one.

Here's a code with reproduces the error

import numpy as np
from streamlit_plotly_events import plotly_events
import plotly.express as px

np.random.seed(1312)

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(x=x[a:b], y=y[a:b])

# Plotly express version
st.plotly_chart(fig)

# Plotly events version
plotly_events(fig)

image
image
Right after clicking

It's not a huge issue but can be slightly inconvenient when handling large datasets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant