plotly / plotly/plotly.R

Hover incorrect when supplying color as argument in add_trace

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

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

主要言語
R
スター
2.7k
フォーク
641
PR マージ指標
30日以内にマージされた PR はありません

説明

I tried to create complex plot using add_trace. However there is problem with the hover when supplying color as argument: In this case the first and last element of the trace has no hover, sometimes it is only the first or only the last:

p1 <- plot_ly() |> 
  add_trace(
    type = "scatter",
    mode = "markers",
    x = 1:3,
    y = 1,
    color = 1:3,
    marker = list(colorscale = list(list(0, "red"), list(1, "orange")))
  )
p1

It works fine with

p2 <- plot_ly() |> 
  add_trace(
    type = "scatter",
    mode = "markers",
    x = 1:3,
    y = 1,
    marker = list(color = 1:3, colorscale = list(list(0, "red"), list(1, "orange")))
  )
p2

When doing the equivalent thing in python with

from plotly import graph_objects as go
fig2 = go.Figure()
fig2.add_trace(
    go.Scatter(x=[1,2,3], y=[1,1,1], type="scatter", mode="markers", marker={"color":[1,2,3], "colorscale":[[0,"red"],[1,"orange"]]})
)
fig1 = go.Figure()
fig1.add_trace(
    go.Scatter(x=[1,2,3], y=[1,1,1], type="scatter", mode="markers", color=[1,2,3], marker={"colorscale":[[0,"red"],[1,"orange"]]})
)

you get an error instead of an incorrect graph, which is better, I would claim.

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

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

はじめの一歩

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

調査の方向性

提供された R add_trace の再現例を出発点として使用し、p1 と p2 を比較して、報告されている端点の hover 動作を確認してください。color-as-argument のケースで最初または最後の点の hover 情報が失われなくなり、例がリグレッションチェックとして機能すれば完了です。

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

評価

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

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

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