talgalili / heatmaply

Interactive Heat Maps for R Using plotly
380 stars 73 forks source link

toWebGL() causes heatmaply to fail to render #302

Closed doliv071 closed 5 months ago

doliv071 commented 10 months ago

Describe the bug

When using toWebGL to convert a heatmaply to webgl, it fails to render all but the axes and color legend

To Reproduce

hm <- heatmaply::heatmaply(matrix(rnorm(25), 5, 5))
hm |> plotly::toWebGL()

Expected behavior

it should plot something

Screenshots

failed_heatmaply_toWebGL

Additional context

Just to see if I could figure out which portion was failing to render using webgl, I modified the type by hand and it plots just fine. Although I'm not entirely sure this is a valid way of causing it to be rendered by webgl...

for(i in 1:length(hm$x$attrs)){ 
    if(!is.null(hm$x$attrs[[i]]$type)){ 
        hm$x$attrs[[i]]$type <- paste0(hm$x$attrs[[i]]$type, "gl") 
    }
}

session info:

> sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS

Matrix products: default
BLAS:   /usr/local/lib/R/lib/libRblas.so
LAPACK: /usr/local/lib/R/lib/libRlapack.so

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

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

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.11        ca_0.71.1          plyr_1.8.9         pillar_1.9.0       compiler_4.2.1    
 [6] RColorBrewer_1.1-3 iterators_1.0.14   viridis_0.6.4      tools_4.2.1        dendextend_1.17.1 
[11] digest_0.6.33      jsonlite_1.8.7     lifecycle_1.0.4    tibble_3.2.1       gtable_0.3.4      
[16] viridisLite_0.4.2  pkgconfig_2.0.3    rlang_1.1.2        foreach_1.5.2      registry_0.5-1    
[21] cli_3.6.1          rstudioapi_0.15.0  crosstalk_1.2.1    yaml_2.3.7         seriation_1.5.3   
[26] TSP_1.2-4          fastmap_1.1.1      gridExtra_2.3      stringr_1.5.1      dplyr_1.1.4       
[31] httr_1.4.7         generics_0.1.3     vctrs_0.6.4        htmlwidgets_1.6.3  grid_4.2.1        
[36] webshot_0.5.5      tidyselect_1.2.0   glue_1.7.0         data.table_1.14.8  R6_2.5.1          
[41] fansi_1.0.5        plotly_4.10.3      reshape2_1.4.4     farver_2.1.1       tidyr_1.3.0       
[46] purrr_1.0.2        ggplot2_3.4.4      magrittr_2.0.3     ellipsis_0.3.2     codetools_0.2-19  
[51] scales_1.3.0       htmltools_0.5.7    assertthat_0.2.1   colorspace_2.1-0   labeling_0.4.3    
[56] utf8_1.2.4         stringi_1.8.2      heatmaply_1.5.0    lazyeval_0.2.2     munsell_0.5.0 
alanocallaghan commented 5 months ago

I appreciate this is not ideal, but plotly heatmaps have been broken in webGL for years, so I'm not inclined to look into it

eg here is a simple mtcars heatmap: Screenshot from 2024-06-11 15-00-43