plotly / plotly/plotly.py

clicktoshow not working for annotations on log scale

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

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

bug P3
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
21

説明

The click event does not seem to be triggered when clicking on an annotated point (even after waiting for the hover text to show up indicating that the point "has been found"). In the example below, the annotation cannot be toggled. With linear axes scaling (dropping the log_x|y and not rescaling x|y=np.log10...) the annotation toggling works as expected.

This bug is probably related to the (forced / unnatural) requirement to rescale the (x,y) coordinates of annotations (see #2580)

x = np.arange(1,5)
df = pd.DataFrame(data={'x':x,'y':x**2,'z':x**3,})

fig = px.line(df,
              x='x',
              y=['y','z'],
              log_x=True,
              log_y=True,
              )

annotations = []
fig.for_each_trace(
    lambda trace: annotations.append(dict(x=np.log10(trace.x[-1]),
                                          y=np.log10(trace.y[-1]),
                                          text=f'({trace.x[-1]:g},{trace.y[-1]:g})',
                                          clicktoshow='onoff',
                                          visible=True,
                                          opacity=0.5,
                                          ))
)

fig.update_layout(annotations=annotations,
                  width=300,
                  height=300,
                  )
fig.show()

image

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

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

はじめの一歩

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

調査の方向性

まず、対数軸を使用した提供済みの Python 例を実行し、線形軸のバージョンと比較します。アノテーションの座標がどのように再スケーリングされるか、また clicktoshow がアノテーション付きの点へのクリックをどのように処理するかを、#2580 の関連コンテキストも含めて追跡します。対数スケールのプロット上でクリックしたときにアノテーションが切り替わり、線形スケーリングにリグレッションが発生しなければ完了です。

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

評価

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

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

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