plotly / plotly/plotly.R

selectedpoints for curvenumber > 0 invisible when using scattergl

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

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

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

説明

I'm not sure if this is an issue with the R library (latest CRAN version 4.12.0) or plotly.js however, when setting selectedpoints on a scattergl trace for curvenumbers > 0, the points turn invisible - for curvenumber 0 it works as it should. If you look closely, you can see that the points were faded out before they are selected and when selected they disappear.

Using a scatter trace instead everything works as expected.

Image

library(shiny)
library(plotly)

DF <- data.frame(
  x = rep(1:10, 3),
  y = c(
    seq(1, 5, length.out = 10),
    seq(1, 7, length.out = 10),
    seq(1, 10, length.out = 10)
  ),
  grp = rep(LETTERS[1:3], each = 10)
)

ui <- fluidPage(
  plotlyOutput("my_plot"),
  selectInput("plot_type", "Plot Type", choices = c("scatter", "scattergl"), selected = "scatter"),
  numericInput(
    inputId = "point_number",
    label = "Point Number",
    value = 0,
    min = 0,
    max = 9
  ),
  numericInput(
    inputId = "curve_number",
    label = "Curve Number",
    value = 0,
    min = 0,
    max = 2
  )
)

server <- function(input, output, session) {
  my_plot_proxy <- plotlyProxy(
    outputId = "my_plot"
  )
  
  observe({
    plotlyProxyInvoke(my_plot_proxy, "restyle", list(selectedpoints = -1)) # deselect all points for all traces
    plotlyProxyInvoke(my_plot_proxy, "restyle", list(selectedpoints = list(I(input$point_number))), input$curve_number)
  })
  
  output$my_plot <- renderPlotly({
    plot_ly(data = DF, type = input$plot_type, mode = "lines+markers", x = ~x, y = ~y, name = ~grp)
  })
}

shinyApp(ui, server)

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

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

はじめの一歩

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

調査の方向性

Issue にある最小限の Shiny 再現コードから始め、curve_number と selectedpoints を変化させながら scatter と scattergl を比較します。0 でない trace に対する plotlyProxyInvoke の restyle パスを追跡します。すべての曲線で選択された点が表示されたままになり、scatter の動作と一致すれば、issue は完了です。

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

評価

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

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

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