Empty event payload for plotly_selected when using ggplotly on geom_tile
オープン
まだ誰も着手していません。
- 主要言語
- R
- スター
- 2.7k
- フォーク
- 641
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
In the example provided below, the heatmap is selectable on the x but the corresponding event payload is empty.
Expected: The selection should be part of the event payload. This works for other plots, e.g. see commented out histogram example in the provided code.
# Source https://rdrr.io/cran/plotly/src/inst/examples/shiny/event_data/app.R
library(plotly)
library(nycflights13)
library(shiny)
library(dplyr)
library(lubridate)
flights = flights %>% mutate(departure = make_datetime(year, month, day, hour, minute))
ui <- fluidPage(
radioButtons("plotType", "Plot Type:", choices = c("ggplotly", "plotly")),
plotlyOutput("plot"),
verbatimTextOutput("brushing"),
)
server <- function(input, output, session) {
output$plot <- renderPlotly({
p <- if (identical(input$plotType, "ggplotly")) {
## works and gives correct results
# ggplotly(ggplot(flights, aes(x = departure)) + geom_histogram())
## gives empty event data
ggplotly(ggplot(head(flights, 10000), aes(x = departure, carrier, fill=arr_time)) + geom_tile())
} else {
plot_ly(mtcars, x = ~mpg, y = ~wt, customdata = nothing)
}
p %>%
layout(dragmode = "select") %>%
# see https://webinars.cpsievert.me/20180220/#13
event_register("plotly_selected")
})
observeEvent(event_data("plotly_selected"), {
d <- event_data("plotly_selected")
print("caught event from here as well")
print(paste(str(d)))
})
}
shinyApp(ui, server)
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
inst/examples/shiny/event_data/app.R にある再現可能な Shiny の例から始め、ggplotly の geom_tile ケースを、動作する histogram ブランチおよび plot_ly ブランチと比較します。event_data("plotly_selected") と event_register("plotly_selected") を追跡します。他の選択可能なプロットと同様に、タイルの選択が空でないペイロードを返せば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- r
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100