【问题标题】:Use heatmaply to create heatmap with raw values/data without transformations?使用 heatmaply 创建带有原始值/数据而不进行转换的热图?
【发布时间】:2020-04-25 02:27:00
【问题描述】:

使用heatmaply::heatmaply() 创建热图时,会对原始数据执行一些转换。这在以下示例中很明显,其中提供了一些 iris 数据集,但将鼠标悬停在热图上会显示一些负值(这些值不在提供给 heatmaply() 的原始数据中),并且侧面的颜色栏也显示为负值价值观。

https://i.stack.imgur.com/Mt0vGm.png

library(heatmaply)
mat <- iris[1:20, 1:4] %>% as.matrix
p <- heatmaply(mat, 
                   dendrogram = "none",
                   xlab = "", ylab = "", 
                   main = "",
                   scale = "column",
                   margins = c(60,100,40,20),
                   grid_color = "white",
                   grid_width = 0.00001,
                   titleX = FALSE,
                   hide_colorbar = FALSE,
                   branches_lwd = 0.1,
                   label_names = c("Country", "Feature:", "Value"),
                   fontsize_row = 5, fontsize_col = 5,
                   labCol = colnames(mat),
                   labRow = rownames(mat),
                   heatmap_layers = theme(axis.line=element_blank()),
                   colors = rev(c("000000", heat.colors(30)[1:28]))
)

p

iris[1:20, 1:4]不同的比例:

https://i.stack.imgur.com/nuMcn.png

问题

如何使heatmaply::heatmaply()仅根据提供的原始值(无转换)生成热图?

注意:开放使用其他包/功能/建议

【问题讨论】:

    标签: r data-visualization heatmaply


    【解决方案1】:

    删除scale 参数 - 默认为“无”。或将其更改为“无”。

    heatmaply(mat, 
              dendrogram = "none",
              xlab = "", ylab = "", 
              main = "",
              # scale = "column",  # <-- remove this line. Or change to "none"
              margins = c(60,100,40,20), ...
    

    【讨论】:

      猜你喜欢
      • 2021-08-13
      • 2019-09-18
      • 2020-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多