简体   繁体   English

使用 heatmaply 创建带有原始值/数据而不进行转换的热图?

[英]Use heatmaply to create heatmap with raw values/data without transformations?

When creating a heatmap with heatmaply::heatmaply() , some transforms are performed on the raw data.使用heatmaply::heatmaply()创建热图时,会对原始数据执行一些转换。 This is evident in the following example where some of the iris dataset is provided, yet hovering over the heatmap shows some negative values (which weren't in the original data provided to heatmaply() ), and the colorbar on the side also shows negative values as well.这在以下示例中很明显,其中提供了一些 iris 数据集,但将鼠标悬停在热图上会显示一些负值(这些值不在提供给heatmaply()的原始数据中),并且侧面的颜色栏也显示为负价值观也是如此。

https://i.stack.imgur.com/Mt0vGm.png 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

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

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

Question问题

How can heatmaply::heatmaply() be made to generate a heatmap based purely on the raw values provided (no transformations)?如何heatmaply::heatmaply()纯粹基于提供的原始值(无转换)生成热图?

Note: open to using other packages/functions/suggestions注意:开放使用其他包/功能/建议

Remove the scale argument - the default is "none".删除scale参数 - 默认为“无”。 Or change it to "none".或将其更改为“无”。

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

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM