# 创建一个基因表达矩阵数据 以此数据为热图单元格颜色
test = matrix(rnorm(200), 20, 10)
test[1:10, seq(1, 10, 2)] = test[1:10, seq(1, 10, 2)] + 2
test[11:20, seq(2, 10, 2)] = test[11:20, seq(2, 10, 2)] + 3
test[15:20, seq(2, 10, 2)] = test[15:20, seq(2, 10, 2)] + 4
colnames(test) = paste("Sample", 1:10, sep = "")
rownames(test) = paste("Gene", 1:20, sep = "")
head(test)
> head(test)
Sample1 Sample2 Sample3 Sample4 Sample5 Sample6 Sample7
Gene1 2.591946 0.94322447 1.1294228 -1.7029648 0.5565071 -1.4958268 1.4481296
Gene2 1.880310 -0.10931712 1.9482818 1.2651684 1.7914298 -0.7684170 0.8172005
Gene3 2.074005 -0.07037692 2.9084477 0.3603572 1.5614365 0.4084885 2.6206636
Gene4 2.741277 -0.48431909 1.2502742 -0.5836394 1.7814062 1.9001363 2.4463130
Gene5 2.753295 -0.13833633 1.6783939 -1.9940788 3.4599659 0.1100091 2.4218847
Gene6 1.737329 -0.06876564 0.8522292 1.9022098 1.4179401 1.1403868 2.4424648
Sample8 Sample9 Sample10
Gene1 1.1504492 1.883642 0.659804377
Gene2 0.1679410 2.925546 -0.453913733
Gene3 -0.5661093 2.648230 -0.694936825
Gene4 -1.0861182 1.849791 -0.006846303
Gene5 -0.6653028 3.040377 1.373052045
Gene6 0.7148484 2.292559 -0.635323077
## 创建一个矩阵,以此数据为单元格数值标签
test1 = matrix(rnorm(200,100), 20, 10)
colnames(test1) = paste("Sample", 1:10, sep = "")
rownames(test1) = paste("Gene", 1:20, sep = "")