datastorm-open / visNetwork

R package, using vis.js library for network visualization
Other
545 stars 125 forks source link

visLegend: different color for NA values? #448

Open nick-youngblut opened 2 years ago

nick-youngblut commented 2 years ago

If there are NA values in the node groups, visLegend() defaults to coloring the NA values as blue, but blue is also the default for the first group of the node groups. It would be helpful if the default for NA groups was grey, or if the user can set the color for NA values in the node (edge) groups.

reprex

nodes <- data.frame(id = c(1:3,NA), group = c("B", "A", "B", NA))
edges <- data.frame(from = c(1,2), to = c(2,3))
visNetwork(nodes, edges, width = "100%") %>%
  visLegend()

Output

Screen Shot 2022-11-27 at 5 02 41 PM

sessionInfo

R version 4.2.1 (2022-06-23)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.6

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
 [1] visNetwork_2.1.2      heatmaply_1.4.0       viridis_0.6.2        
 [4] viridisLite_0.4.1     reactablefmtr_2.0.0   data.tree_1.0.0      
 [7] ape_5.6-2             glue_1.6.2            tidyr_1.2.1          
[10] shinycssloaders_1.0.0 shinyWidgets_0.7.4    shinyBS_0.61.1       
[13] reactable_0.3.0       plotly_4.10.0         ggplot2_3.3.6        
[16] shinyTree_0.2.7       paws_0.1.12           ggtree_3.4.4         
[19] treeio_1.20.2         collapsibleTree_0.1.7 RPostgres_1.4.4      
[22] DBI_1.1.3             tidytable_0.9.0       data.table_1.14.2    
[25] dplyr_1.0.10          jsonlite_1.8.2        httr_1.4.4           
[28] shiny_1.7.2          

loaded via a namespace (and not attached):
 [1] nlme_3.1-157                  lubridate_1.8.0              
 [3] bit64_4.0.5                   webshot_0.5.4                
 [5] RColorBrewer_1.1-3            tools_4.2.1                  
 [7] bslib_0.4.0                   utf8_1.2.2                   
 [9] R6_2.5.1                      lazyeval_0.2.2               
[11] colorspace_2.0-3              withr_2.5.0                  
[13] tidyselect_1.1.2              gridExtra_2.3                
[15] curl_4.3.2                    bit_4.0.4                    
[17] compiler_4.2.1                cli_3.4.1                    
[19] TSP_1.2-1                     labeling_0.4.2               
[21] sass_0.4.2                    scales_1.2.1                 
[23] stringr_1.4.1                 digest_0.6.29                
[25] yulab.utils_0.0.5             R.utils_2.12.2               
[27] ca_0.71.1                     pkgconfig_2.0.3              
[29] htmltools_0.5.3               dbplyr_2.2.1                 
[31] fastmap_1.1.0                 htmlwidgets_1.5.4            
[33] rlang_1.0.6                   rstudioapi_0.14              
[35] farver_2.1.1                  gridGraphics_0.5-1           
[37] jquerylib_0.1.4               generics_0.1.3               
[39] crosstalk_1.2.0               R.oo_1.25.0                  
[41] dendextend_1.16.0             magrittr_2.0.3               
[43] ggplotify_0.1.0               patchwork_1.1.2              
[45] Rcpp_1.0.9                    munsell_0.5.0                
[47] fansi_1.0.3                   R.methodsS3_1.8.2            
[49] lifecycle_1.0.2               stringi_1.7.8                
[51] yaml_2.3.5                    plyr_1.8.8                   
[53] grid_4.2.1                    blob_1.2.3                   
[55] parallel_4.2.1                promises_1.2.0.1             
[57] crayon_1.5.2                  lattice_0.20-45              
[59] hms_1.1.2                     pillar_1.8.1                 
[61] igraph_1.3.5                  reshape2_1.4.4               
[63] paws.common_0.5.1             codetools_0.2-18             
[65] ggfun_0.0.7                   renv_0.15.5                  
[67] BiocManager_1.30.18           vctrs_0.4.2                  
[69] httpuv_1.6.6                  foreach_1.5.2                
[71] gtable_0.3.1                  purrr_0.3.4                  
[73] reactR_0.4.4                  assertthat_0.2.1             
[75] cachem_1.0.6                  mime_0.12                    
[77] xtable_1.8-4                  tidytree_0.4.1               
[79] later_1.3.0                   seriation_1.4.0              
[81] tibble_3.1.8                  iterators_1.0.14             
[83] aplot_0.1.7                   registry_0.5-1               
[85] memoise_2.0.1                 paws.security.identity_0.1.12
[87] ellipsis_0.3.2