plotly / plotly/plotly.R

highlight_key selects wrong category with boxplots and violin figures.

Abierto
#1,969 0 comentarios 0 reacciones 0 asignados Ver en GitHub

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

the problem

When a highlight_key(~group) is added to a boxplot figure or violin figure, with the highlight group equal to the categorical x-value of the boxplot/violin figure, the wrong category gets highlighted in the figure when clicking on a box or violin.

However, the correct category gets shown when I click on an outlier point.

Minimal example:
library(plotly)
data <- mtcars 
data$cyl <- as.character(data$cyl) #make cyl categorical

data %>%
	highlight_key(~cyl) %>%
	plot_ly(
		x = ~cyl, y = ~mpg,
		type = "box"
		)

Screenshot example below, where I had clicked the box with category cyl=8, but cyl=4 highlighted up:

Screenshot from 2021-06-29 10-02-32

But if click on the one outlier below the box of cyl=8, the highlight is correct.

expected behaviour

When I click on the box part, the correct category gets highlighted.

System info:
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8          LC_NUMERIC=C                 
 [3] LC_TIME=de_BE.UTF-8           LC_COLLATE=en_US.UTF-8       
 [5] LC_MONETARY=de_BE.UTF-8       LC_MESSAGES=en_US.UTF-8      
 [7] LC_PAPER=de_BE.UTF-8          LC_NAME=de_BE.UTF-8          
 [9] LC_ADDRESS=de_BE.UTF-8        LC_TELEPHONE=de_BE.UTF-8     
[11] LC_MEASUREMENT=de_BE.UTF-8    LC_IDENTIFICATION=de_BE.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] plotly_4.9.4.1 ggplot2_3.3.3  rj_4.0.1-2    

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.6        later_1.2.0       pillar_1.6.0      compiler_3.6.3   
 [5] tools_3.6.3       digest_0.6.27     rj.gd_4.0.1-0     jsonlite_1.7.2   
 [9] lifecycle_1.0.0   tibble_3.1.1      gtable_0.3.0      viridisLite_0.4.0
[13] pkgconfig_2.0.3   rlang_0.4.11      shiny_1.6.0       DBI_1.1.1        
[17] crosstalk_1.1.1   yaml_2.2.1        fastmap_1.1.0     withr_2.4.2      
[21] dplyr_1.0.6       httr_1.4.2        generics_0.1.0    vctrs_0.3.8      
[25] htmlwidgets_1.5.3 grid_3.6.3        tidyselect_1.1.1  glue_1.4.2       
[29] data.table_1.14.0 R6_2.5.0          fansi_0.4.2       purrr_0.3.4      
[33] tidyr_1.1.3       magrittr_2.0.1    promises_1.2.0.1  scales_1.1.1     
[37] ellipsis_0.3.2    htmltools_0.5.1.1 assertthat_0.2.1  xtable_1.8-4     
[41] mime_0.10         colorspace_2.0-1  httpuv_1.6.0      utf8_1.2.1       
[45] lazyeval_0.2.2    munsell_0.5.0     crayon_1.4.1     

The same behaviour was also reproduced on a windows machine running R 4.0.3

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con el ejemplo mínimo de highlight_key(~cyl) y plot_ly(type = "box") del issue y, a continuación, sigue la ruta de interacción de highlight_key para las figuras de boxplot y violin. Se considera terminado cuando hacer clic en un boxplot o violin resalta su valor x categórico, coincidiendo con el comportamiento existente para los puntos atípicos; añade una comprobación de regresión si se encuentra la ubicación de prueba relevante.

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
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.