Empty event payload for plotly_selected when using ggplotly on geom_tile
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- R
- Estrellas
- 2.7k
- Forks
- 641
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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)
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el ejemplo reproducible de Shiny de inst/examples/shiny/event_data/app.R y compara el caso de ggplotly con geom_tile con las ramas funcionales de histograma y plot_ly. Sigue event_data("plotly_selected") y event_register("plotly_selected"); el trabajo estará terminado cuando la selección de tiles devuelva un payload no vacío, como los otros gráficos seleccionables.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- r
- Área
- data-visualization
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100