Filtering Streamlit Dataframe based on Bokeh Lasso

Is the any way to show the selected items from a bokeh plot in a a streamlit dataframe/table ? I found this github

but even the example is not working for me.

The problem is, that this is not rendering a plot:

plot.scatter("sepal_length", "sepal_width", fill_alpha=0.5, color="colors", size=10, line_color=None, source=cds_lasso)
with col2:
    result_lasso = streamlit_bokeh_events(
        bokeh_plot=plot,
        events="LASSO_SELECT",
        key="bar",
        refresh_on_update=True,
        debounce_time=0)
    if result_lasso:
        st.write("Event Lasso")
        if result_lasso.get("LASSO_SELECT"):
            st.write(df.iloc[result_lasso.get("LASSO_SELECT")["data"]])

I got it working using plotly express and the streamlit_plotly_events component

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.