【发布时间】:2021-12-27 05:53:39
【问题描述】:
考虑矩阵:
test = matrix(rnorm(200), 20, 10)
test[1:10, seq(1, 10, 2)] = test[1:10, seq(1, 10, 2)] + 3
test[11:20, seq(2, 10, 2)] = test[11:20, seq(2, 10, 2)] + 2
test[15:20, seq(2, 10, 2)] = test[15:20, seq(2, 10, 2)] + 4
colnames(test) = paste("Test", 1:10, sep = "")
rownames(test) = paste("Gene", 1:20, sep = "")
#创建要划分的组
group_df = data.frame(Groups=rep(c("Control", "Treated"), c(5,5)))
rownames(group_df) <- colnames(test)
#生成热图:
pheatmap(test, cluster_cols = FALSE, scale = 'row',
annotation_col = group_df,
show_colnames = FALSE,
border_color = "white",
colorRampPalette(c("#00FF00", "white", "#DC143C"))(75),
gaps_col = cumsum(c(5,5)))
如何将Control 和Treated 的颜色从蓝色和红色更改为不同的颜色?
【问题讨论】: