【问题标题】:how to put key values and legends at the bottom of the heatmap如何将键值和图例放在热图的底部
【发布时间】:2020-09-18 07:39:35
【问题描述】:

有没有人告诉我如何使用 pheatmap 将表达式键索引和图例键显示在热图的底部?您可以使用以下代码生成热图。 非常感谢!

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 = "")
annotation_col = data.frame(
  CellType = factor(rep(c("CT1", "CT2"), 5)), Time = c("A", "B", "C","D","E"))
rownames(annotation_col) = paste("Test",1:10, sep = "")
ann_colors = list(
    Time = c(A = "white", B= "firebrick", C= "#fdbb84",D = "#e34a33", E = "red"),
    CellType = c(CT1 = "#1B9E77", CT2 = "#D95F02")) 

library("pheatmap")
pheatmap(test, annotation_col = annotation_col, annotation_colors = ann_colors)
  

【问题讨论】:

  • 请始终包含library 电话,这一次我帮助了你。

标签: r pheatmap


【解决方案1】:

pheatmap 似乎无法控制图例的位置。

绘制热图的代码可以在这里找到https://github.com/raivokolde/pheatmap

查看R/pheatmap-package.r 文件。

那个图例似乎是硬编码的,见# Legend positiondraw_legend = function(color, breaks, legend, ...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-03
    • 1970-01-01
    • 2013-07-29
    • 2017-06-19
    • 2021-09-29
    • 1970-01-01
    • 2020-09-09
    • 1970-01-01
    相关资源
    最近更新 更多