circlize画热图
2020-09-16 本文已影响0人
生信编程日常
circlize软件包从0.4.10版本开始,可以使用circos.heatmap(),画圆形热图,圆形热图不但漂亮,而且可以缩小图片占用的面积。circos.heatmap()功能 大大简化了环状热图的创建。下面是circos.heatmap()功能的用法。
首先,我们生成一个随机矩阵并将其随机分为五个组。
set.seed(123)
mat1 = rbind(cbind(matrix(rnorm(50*5, mean = 1), nr = 50),
matrix(rnorm(50*5, mean = -1), nr = 50)),
cbind(matrix(rnorm(50*5, mean = -1), nr = 50),
matrix(rnorm(50*5, mean = 1), nr = 50))
)
rownames(mat1) = paste0("R", 1:100)
colnames(mat1) = paste0("C", 1:10)
mat1 = mat1[sample(100, 100), ] # randomly permute rows
split = sample(letters[1:5], 100, replace = TRUE)
split = factor(split, levels = letters[1:5])
head(mat1)
library(ComplexHeatmap)
Heatmap(mat1, row_split = split)
library(circlize) # >= 0.4.10
col_fun1 = colorRamp2(c(-2, 0, 2), c("blue", "white", "red"))
circos.heatmap(mat1, split = split, col = col_fun1)
circos.clear()
circlize更多功能:https://jokergoo.github.io/circlize_book/book/circos-heatmap.html#a-complex-example-of-circular-heatmaps
欢迎关注~