【问题标题】:Remove space between gheatmap tiles删除热图图块之间的空间
【发布时间】:2021-08-10 13:50:59
【问题描述】:

我正在用 ggtree 和 gheatmap 创建一棵树。我正在尝试解决如何删除尖端瓷砖之间的空间和/或合并具有相同值的相邻瓷砖。

下面是我使用的代码:

library(ape)
library(tidyverse)
library(ggtree)

tree <- rtree(50)
tree_plot <- ggtree(tree, size = 1, layout = "circular", branch.length = "none")

dummy_data <- data.frame(data = c(rep(1,10),rep(2,10),rep(3,10), rep(4,10), rep(5,10)))
row.names(dummy_data) <- tree$tip.label

gheat_Sensitivity <- gheatmap(p = tree_plot, data=dummy_data, width=0.1, colnames = FALSE) +
new_scale(aes(color = dummy_data)) +
scale_fill_gradientn(colors = c("grey", "yellow"), breaks = c(1, 5.0))

plot(gheat_Sensitivity)

这将创建我所追求的树: ggtree plot

但是,我想删除热图图块之间的间距,以便对其进行连续查看。具体来说,我希望具有相同值的相邻图块看起来像一个更大的图块。

任何帮助将不胜感激, 干杯, 汤姆

【问题讨论】:

    标签: r heatmap ggtree


    【解决方案1】:

    有点晚了,但对于遇到同样问题的其他人,您可以将 colour=NA 添加到 gheatmap 调用中,即

    gheatmap(p = tree_plot, data=dummy_data, width=0.1, colnames = FALSE, color=NA) 
    

    See here - heatmap with the left with the row space, right after using color=NA.

    【讨论】:

      猜你喜欢
      • 2019-06-13
      • 2020-10-16
      • 2014-02-04
      • 2015-04-09
      • 2015-10-10
      • 1970-01-01
      • 2017-04-25
      • 2018-04-11
      • 2011-11-30
      相关资源
      最近更新 更多