我使用以下代码制作了热图:
library(pheatmap)
library(dplyr)
data = data.frame(matrix(runif(10*10), ncol=10))
data$sample = rep(c("tumour", "normal"), 5)
data$subject.ID = paste('Subject', 1:10)
data = data %>% arrange(sample)
# for row annotation
my_sample_col = data %>% select(sample)
rownames(my_sample_col) = data$subject.ID
# data matrix
mat = as.matrix(data %>% select(-sample, -subject.ID))
rownames(mat) = data$subject.ID
pheatmap(mat,
scale='row',
annotation_row = my_sample_col,
annotation_names_row=F,
cluster_rows = FALSE,
cluster_cols = FALSE,
show_colnames = FALSE,
show_rownames = FALSE)
我想在第 5 行和第 6 行之间放置一个间隙,以根据我的行注释分隔热图。
在pheatmap
功能上,这个论点gaps_row
似乎起到了作用。
vector of row indices that show shere to put gaps into heatmap. Used only if the rows are not clustered.
我不确定如何实现。有人可以帮我弄这个吗?非常感谢。