plotly / plotly/plotly.py

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

オープン
#4,531 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

feature P3
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
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...

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

go.FigureWidget の例から始め、layout.dragmode、modebar のオプション、および issue で説明されている go.Heatmap のインタラクションに重点を置きます。図に Heatmap しか含まれていない場合に、選択コールバックと選択範囲がどのように公開されるかを確認します。ダミーの go.Scatter を追加せずに、modebar から pan または zoom と select を切り替えられれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
data-visualization
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。