How to display the raw values on each heatmap?
Rensiyu1128 opened this issue · comments
library(tidyverse)
library(circlize)
library(ComplexHeatmap)
set.seed(123)
mat1 = rbind(cbind(matrix(rnorm(105, mean = 1), nr = 10),
matrix(rnorm(105, mean = -1), nr = 10)),
cbind(matrix(rnorm(105, mean = -1), nr = 10),
matrix(rnorm(105, mean = 1), nr = 10))
)
rownames(mat1) = paste0("R", 1:20)
colnames(mat1) = paste0("C", 1:10)
mat1 = mat1[sample(20,20), ]
split = sample(letters[1:5],20, replace = TRUE)
split = factor(split, levels = letters[1:5])
mat1 = round(mat1,2)
mat2 <- mat1 %>%
as.data.frame() %>%
select(1)
mat3 = mat1[,1]
col_fun = colorRamp2(c(-2, 0, 2), c("white", "white", "white"))
col_fun1 = colorRamp2(c(-2,-1,0,1,2),
viridis::mako(5,begin = 0.6,end = 1,direction = -1))
circos.clear()
circos.par(canvas.xlim=c(-1,1),canvas.ylim=c(-1,1.1),start.degree = 0,
start.degree = 90, gap.degree =5)
circos.heatmap(mat2, split = split, col = col_fun, track.height =0.0000001,
bg.border = "white",show.sector.labels = F)
circos.trackPlotRegion(ylim = c(0,0.1),track.height = 0.08,
panel.fun = function(x, y) {
chr = CELL_META$sector.index
xlim = CELL_META$xlim
ylim = CELL_META$ylim
circos.text(mean(xlim),mean(ylim),chr,cex = 1,
col = "black",facing = "outside", niceFacing = T)
})
circos.heatmap(mat1 %>%
as.data.frame() %>%
select(1),
rownames.side = "none",
split = split, col = col_fun1,
track.height = 0.1, cell_width=0.1,
cell.border = "black",
show.sector.labels = F)