Skip to content

Chart reloading entirely upon changing data #12

@HugoAndre276

Description

@HugoAndre276

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions