plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

Scatter3d.on_click doesn't receive InputDeviceState object

Open ruoyu0088 opened this issue 1 year ago • 0 comments

Here is the code:

import plotly.graph_objects as go
import numpy as np
import ipywidgets

np.random.seed(1)

scatter_1 = go.Scatter3d(x=np.random.rand(100), y=np.random.rand(100), z=np.random.rand(100), mode='markers', marker={"size":2},)

f = go.FigureWidget()
f.add_trace(scatter_1)

o = ipywidgets.Output()

@o.capture(clear_output=True)  
def callback(trace, points, selector):
    print(points)
    print(selector)
        
f.data[0].on_click(callback)

ipywidgets.HBox([f, o])

click on any point, and the output is as following, the selector argument is None:

Points(point_inds=[69],
       xs=[0.5865550405019929],
       ys=[0.5688514370864813],
       trace_name='trace 0',
       trace_index=0)
None

ruoyu0088 avatar Jul 23 '24 07:07 ruoyu0088