library(ComplexHeatmap)
#> Loading required package: grid
#> ========================================
#> ComplexHeatmap version 2.24.0
#> Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
#> Github page: https://github.com/jokergoo/ComplexHeatmap
#> Documentation: http://jokergoo.github.io/ComplexHeatmap-reference
#>
#> If you use it in published research, please cite either one:
#> - Gu, Z. Complex Heatmap Visualization. iMeta 2022.
#> - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional
#> genomic data. Bioinformatics 2016.
#>
#>
#> The new InteractiveComplexHeatmap package can directly export static
#> complex heatmaps into an interactive Shiny app with zero effort. Have a try!
#>
#> This message can be suppressed by:
#> suppressPackageStartupMessages(library(ComplexHeatmap))
#> ========================================
library(pheatmap)
#>
#> Attaching package: 'pheatmap'
#> The following object is masked from 'package:ComplexHeatmap':
#>
#> pheatmap
library(gplots)
#>
#> Attaching package: 'gplots'
#> The following object is masked from 'package:stats':
#>
#> lowess
library(ggalign)
#> Loading required package: ggplot2
Compared with other packages
A simple heatmap.
bench::mark(
"heatmap()" = {
pdf(NULL)
heatmap(mat, Rowv = NA, Colv = NA)
dev.off()
NULL
},
"heatmap.2()" = {
pdf(NULL)
heatmap.2(mat, dendrogram = "none", trace = "none")
dev.off()
NULL
},
"Heatmap()" = {
pdf(NULL)
draw(Heatmap(mat,
cluster_rows = FALSE, cluster_columns = FALSE,
use_raster = TRUE
))
dev.off()
NULL
},
"pheatmap()" = {
pdf(NULL)
pheatmap(mat, cluster_rows = FALSE, cluster_cols = FALSE)
dev.off()
NULL
},
"ggalign()" = {
pdf(NULL)
print(ggheatmap(mat, filling = "raster"))
dev.off()
NULL
}
)
#> Warning: Some expressions had a GC in every iteration; so filtering is
#> disabled.
#> # A tibble: 5 × 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 heatmap() 150.64ms 160.78ms 6.24 138.85MB 7.81
#> 2 heatmap.2() 2.51s 2.51s 0.398 224.22MB 0.398
#> 3 Heatmap() 4.31s 4.31s 0.232 792.74MB 2.32
#> 4 pheatmap() 591.45ms 591.45ms 1.69 112.58MB 3.38
#> 5 ggalign() 2.07s 2.07s 0.483 2.48GB 9.18
For heatmap with dendrogram
bench::mark(
"heatmap()" = {
pdf(NULL)
heatmap(mat)
dev.off()
NULL
},
"heatmap.2()" = {
pdf(NULL)
heatmap.2(mat, trace = "none")
dev.off()
NULL
},
"Heatmap()" = {
pdf(NULL)
draw(Heatmap(mat,
row_dend_reorder = FALSE, column_dend_reorder = FALSE,
use_raster = TRUE
))
dev.off()
NULL
},
"pheatmap()" = {
pdf(NULL)
pheatmap(mat)
dev.off()
NULL
},
"ggalign()" = {
pdf(NULL)
print(ggheatmap(mat, filling = "raster") +
anno_top() + align_dendro() +
anno_right() + align_dendro())
dev.off()
NULL
}
)
#> Warning: Some expressions had a GC in every iteration; so filtering is
#> disabled.
#> # A tibble: 5 × 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 heatmap() 2.71s 2.71s 0.370 173.72MB 1.11
#> 2 heatmap.2() 2.81s 2.81s 0.356 223.41MB 1.07
#> 3 Heatmap() 5.63s 5.63s 0.178 1.51GB 1.60
#> 4 pheatmap() 2.24s 2.24s 0.446 166.08MB 0.446
#> 5 ggalign() 5.15s 5.15s 0.194 2.55GB 4.27