Cropping time data using interactive plotly plot


Hi All,

I am trying to crop data using a plotly graph to select snippets and analyze. Having a lot of trouble getting any info from the selected regions of the graph. Any thoughts?

Steps to reproduce

Code snippet:

fig1 = go.Figure()

    	line_color = 'blue',
    	name = 'boat speed'))

	# Retrieve selected data points
	selected_points =[0].selectedpoints

	if selected_points:
	    # Extract x values of selected points
	    selected_x_values = [[0].x[i] for i in selected_points]

	    # Compute the minimum and maximum x values
	    min_x = min(selected_x_values)
	    max_x = max(selected_x_values)

	    st.write("Selected x values:")
	    st.write("Minimum x value:")
	    st.write("Maximum x value:")
	    st.write("No points selected.")

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

Expected behavior:

Explain what you expect to happen when you run the code above.

Actual behavior:

Explain the undesired behavior or error you see when you run the code above.
If you’re seeing an error message, share the full contents of the error message here.

Debug info

  • Streamlit version: (get it with $ streamlit version)
  • Python version: (get it with $ python --version)
  • Using Conda? PipEnv? PyEnv? Pex?
  • OS version:
  • Browser version:

Requirements file

Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.


  • Link to your GitHub repo:
  • Link to your deployed app:

Additional information

If needed, add any other context about the problem here.

Indeed, there is no builtin way to get back data from plotly to your application. There is streamlit-plotly-events, but it has been unmaintained for more than two years. Give it a try anyway.

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