plotly / plotly/plotly.py

Scatter3d.on_click doesn't receive InputDeviceState object

Open
#4,687 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied Python FigureWidget example and the f.data[0].on_click(callback) entry point; reproduce the click in a notebook and trace how points and selector are passed to callback. Done means Scatter3d.on_click supplies the reported InputDeviceState object rather than leaving selector as None.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.