add option to add "select" mode on any figure (specifically, Heatmap)
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
It doesn't seem possible to add a "select" dragmode to a figure with a go.Heatmap object. You can specify the starting dragmode as "select", in which case you can immediately drag and select. But if I wanted to pan, I can't choose to select afterwards. I cannot add it to the modebar. I would like to be able to do this so I can select a region of interest on my heatmap, and setup a callback to set this region of interest in my code. I don't care about actually selecting the points in the heatmap, just the bounds of the selection box.
My workaround to this is to add a go.Scatter to my figure:
layout = go.Layout(
showlegend=False,
autosize=False,
xaxis=dict(
showgrid=False,
zeroline=False,
visible=False,
range=[0, images.shape[2] - 1],
),
yaxis=dict(
showgrid=False,
zeroline=False,
visible=False,
range=[images.shape[1] - 1, 0],
scaleanchor="x",
scaleratio=1,
),
dragmode="zoom",
modebar=go.layout.Modebar(remove=["lasso"]),
)
heat = go.FigureWidget(
data=[
go.Scatter(
x=[0],
y=[0],
),
go.Heatmap(z=current_image, colorscale="Viridis"),
],
layout=layout,
)
This works, but is kind of silly...
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 go.FigureWidget 示例开始,重点关注 issue 中描述的 layout.dragmode、modebar options 以及 go.Heatmap 交互。检查当图形只包含 Heatmap 时,选择回调和选择边界是如何暴露的。完成标准是:无需添加虚拟的 go.Scatter,即可通过 modebar 在平移或缩放与选择之间切换。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- data-visualization
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100