plotly / plotly/plotly.R

highlight_key selects wrong category with boxplots and violin figures.

Đang mở
#1,969 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
R
Star
2.7k
Fork
641
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với ví dụ tối thiểu về highlight_key(~cyl) và plot_ly(type = "box") trong issue, sau đó lần theo đường dẫn tương tác của highlight_key đối với các biểu đồ boxplot và violin. Công việc được hoàn tất khi việc nhấp vào một boxplot hoặc violin làm nổi bật giá trị x phân loại của nó, khớp với hành vi hiện có của các điểm ngoại lệ; thêm một kiểm tra hồi quy nếu tìm thấy vị trí kiểm thử liên quan.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
r
Lĩnh vực
data-visualization
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.