在热图R中更改一个注释的颜色

时间:2017-11-02 22:29:07

标签: r heatmap pheatmap

我在R中做了一个热图。我在Exam $ Design中有几个注释,我想改变注释的颜色'条件'因为你可以从情节中看到它们看起来非常相似,但事实上并非如此(正如在条件中看到的那样,条件'列中有2个变量)。

这是我正在使用的代码:

pheatmap::pheatmap(
    mat=yeast_EM, 
    kmeans_k=100, 
    annotation_col=Exam$Design, 
    scale = "row", 
    cellwidth = 15, 
    cellheight = 12, 
    fontsize = 8, 
    color = brewer.pal(name = "Spectral", n = 10), 
    filename = "heat_map.png")

输出如下:

heat_map

我正在使用: R版本3.3.2(2016-10-31) 平台:x86_64-apple-darwin13.4.0(64位) 运行于:macOS Sierra 10.12.6

这是yeast_EM数据的一个例子:

   sample1      sample2   sample3     sample4     sample5

gene1 6.36905642 6.73133314 6.31220164 5.96876520 6.41847351

gene2 7.88187347 7.80500924 9.04985474 5.26179387 6.46439153

gene3 -0.93509624 1.08347695 4.03031906 3.34657410 -2.67209858

这就是Exam $ Design数据框的样子:

  strain condition batch replicate  technician  time  week

sample1 wt exp bio1 BSc早上工作日

sample2 wt stress A biological2 Tech下午周末

sample3 mut exp生物3 BSc下午工作日

sample4 mut stress A bio4 BSc下午工作日

任何人都可以帮忙吗?

0 个答案:

没有答案