plotly / plotly/plotly.py

Scatter3d.on_click doesn't receive InputDeviceState object

未关闭
#4,687 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug P3
主要语言
Python
星标
18.8k
派生
2.8k
平均合并
16 小时 26 分钟
30 天内合并 PR
21

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从提供的 Python FigureWidget 示例和入口点 f.data[0].on_click(callback) 开始;在 notebook 中重现点击操作,并跟踪 points 和 selector 如何传递给 callback。当 Scatter3d.on_click 提供所报告的 InputDeviceState 对象,而不是让 selector 保持为 None 时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
jupyter-notebook, python
领域
data-visualization
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。