plotly / plotly/plotly.R

ggplotly() is not displaying the tooltip with option hoveron="fills"

Đang mở
#1,798 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 hover text / tooltip is not being displayed:

library(ggplot2)
library(plotly)
library(sf)

nc <- st_read(system.file("shape/nc.shp", package="sf")) %>% 
         dplyr::mutate('BIR74_intervals'=cut(BIR74,breaks=6,dig.lab=5))

map <- ggplot() + geom_sf(data=nc,
  aes(fill=BIR74_intervals, text=paste0("Name: ", NAME, "\n",BIR79)))

map %>% ggplotly(tooltip=c("text")) %>% style(hoveron='fills') 

However, if %>% style(hoveron='fills') is removed, then the tooltip appears.

Moreover, if text is set to just text=paste0("Name: ", NAME), the tooltip is displayed but in a wrong way.

Thanks in advance.

> sessionInfo()

R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
[1] sf_0.9-3       plotly_4.9.2.1 ggplot2_3.3.0  h2o_3.30.0.1  

loaded via a namespace (and not attached):
 [1] tidyselect_1.0.0    xfun_0.13           purrr_0.3.4        
 [4] haven_2.2.0         lattice_0.20-38     labelled_2.3.1     
 [7] colorspace_1.4-1    vctrs_0.3.0         generics_0.0.2     
[10] htmltools_0.4.0     viridisLite_0.3.0   yaml_2.2.1         
[13] rlang_0.4.6         e1071_1.7-3         huxtable_4.7.1.9000
[16] pillar_1.4.4        foreign_0.8-71      glue_1.4.1         
[19] withr_2.2.0         DBI_1.1.0           matrixStats_0.56.0 
[22] lifecycle_0.2.0     stringr_1.4.0       munsell_0.5.0      
[25] gtable_0.3.0        htmlwidgets_1.5.1   forcats_0.5.0      
[28] knitr_1.28          crosstalk_1.1.0.1   class_7.3-15       
[31] fansi_0.4.1         htmlTable_1.13.3    Rcpp_1.0.4.6       
[34] KernSmooth_2.23-15  backports_1.1.6     checkmate_2.0.0    
[37] scales_1.1.1        DT_0.13.4           classInt_0.4-3     
[40] jsonlite_1.6.1      farver_2.0.3        expss_0.10.2       
[43] hms_0.5.3           digest_0.6.25       packrat_0.5.0      
[46] stringi_1.4.6       dplyr_0.8.5         grid_3.6.1         
[49] cli_2.0.2           tools_3.6.1         bitops_1.0-6       
[52] magrittr_1.5        lazyeval_0.2.2      RCurl_1.98-1.2     
[55] tibble_3.0.1        pacman_0.5.1        crayon_1.3.4       
[58] tidyr_1.0.3         pkgconfig_2.0.3     ellipsis_0.3.1     
[61] Matrix_1.2-17       data.table_1.12.8   lubridate_1.7.8    
[64] assertthat_0.2.1    httr_1.4.1          rstudioapi_0.11    
[67] R6_2.4.1 

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 bằng cách chạy bản tái hiện được cung cấp với sf, ggplot2 và plotly, rồi so sánh tooltip khi có và không có style(hoveron='fills'). Truy vết đầu ra của ggplotly() và cách xử lý hoveron; công việc được xem là hoàn tất khi tooltip văn bản hiển thị chính xác cho bản đồ sf khi áp dụng hoveron='fills'.

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ó
3/5
Thời gian dự kiến
1-2 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
45/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.