selectedpoints for curvenumber > 0 invisible when using scattergl
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, r
- Domain
- data-visualization
Research direction
Start with the minimal Shiny reproduction in the issue and compare scatter with scattergl while varying curve_number and selectedpoints. Trace the plotlyProxyInvoke restyle path for nonzero traces; the issue is done when selected points remain visible for every curve, matching scatter behavior.
Written by the indexing model from the issue text.
Description
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.
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)
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from plotly/plotly.R
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
-
save_image Error Open
Difficulty 3/5 1-2 days Newbie friendliness 52/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
easystats/performance#950 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
briandconnelly/airnow#9 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
OHDSI/CohortConstructor#774 ·