add option to add "select" mode on any figure (specifically, Heatmap)

未關閉
#4,531 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
38/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
python

研究方向

從 go.FigureWidget 範例開始,聚焦於 issue 中描述的 layout.dragmode、modebar 選項,以及 go.Heatmap 互動。檢查當圖表只包含 Heatmap 時,選取回呼和選取邊界是如何提供的。完成的標準是:無需加入虛設的 go.Scatter,即可透過 modebar 在 pan 或 zoom 與 select 之間切換。

由索引模型根據 Issue 內容生成。

描述

feature P3

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...

主要語言
Python
星號
18.8k
分支
2.8k
平均合併
16 小時 26 分鐘
30 天內合併 PR
21

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

plotly/plotly.py 的其他 Issue

查看 plotly/plotly.py 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。