Skip to content

on_selection callback seems to not get fired #3910

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

Open
Ben-Epstein opened this issue Oct 2, 2022 · 2 comments
Open

on_selection callback seems to not get fired #3910

Ben-Epstein opened this issue Oct 2, 2022 · 2 comments
Labels
bug something broken P3 backlog

Comments

@Ben-Epstein
Copy link

Thanks for your interest in Plotly.py!

Before opening an issue, please search for existing and closed issues :)

Please accompany bug reports with a reproducible example. Please use the latest version of plotly.py in your report unless not applicable.

Note that GitHub Issues are meant to be used for bug reports and feature requests only. Implementation or usage questions should be asked on community.plotly.com or on Stack Overflow (tagged plotly).

It seems the on_selection callback does not fire anymore. I've seen a number of open and closed issues back from 2020 discussing the usage of it, but based on the newest version 5.10.0 I cannot get anything to fire on a selection.

The simplest code example I could find (from #2698)


import plotly.graph_objects as go
import numpy as np

np.random.seed(1)
x = np.random.randn(500)

def on_selection_print(obj, points, selector):
    print(points.point_inds)

figure_widget = go.FigureWidget(data=[go.Histogram(x=x)])
figure_widget.update_layout(dragmode="select")    
figure_widget.data[0].on_selection(on_selection_print)
figure_widget.show()

Both running this in jupyter or as a python script, nothing seems to print.

I tried the latest docs on selection events but I couldn't actually get that example to run in jupyter or otherwise.

Am I just missing something simple?

Thanks!

@hkhanal
Copy link

hkhanal commented Mar 7, 2024

@Ben-Epstein Did you resolve this issue. I am getting the same problem

@Ben-Epstein
Copy link
Author

@hkhanal it's still broken for me

@gvwilson gvwilson self-assigned this Jul 11, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added P3 backlog bug something broken labels Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 backlog
Projects
None yet
Development

No branches or pull requests

3 participants