plotly / plotly/plotly.R

highlight_key selects wrong category with boxplots and violin figures.

Ouverte
#1,969 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
R
Étoiles
2.7k
Forks
641
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par l’exemple minimal highlight_key(~cyl) et plot_ly(type = "box") de l’issue, puis suivez le chemin d’interaction de highlight_key pour les figures de boxplot et de violin. Le travail est terminé lorsqu’un clic sur un boxplot ou un violin met en évidence sa valeur x catégorielle, comme le comportement existant pour les points aberrants ; ajoutez une vérification de régression si l’emplacement de test pertinent est trouvé.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
r
Domaine
data-visualization
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
42/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.