1

使用 创建热图时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()生成热图?

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

4

1 回答 1

1

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

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

在此处输入图像描述

于 2020-04-25T03:27:07.290 回答