使用 heatmaply 创建带有原始 values/data 的热图而不进行转换?
Use heatmaply to create heatmap with raw values/data without transformations?
使用 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()
仅基于 提供的原始值 生成热图(无转换)?
注意:开放使用其他packages/functions/suggestions
删除 scale
参数 - 默认值为 "none"。或者改成"none".
heatmaply(mat,
dendrogram = "none",
xlab = "", ylab = "",
main = "",
# scale = "column", # <-- remove this line. Or change to "none"
margins = c(60,100,40,20), ...
使用 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()
仅基于 提供的原始值 生成热图(无转换)?
注意:开放使用其他packages/functions/suggestions
删除 scale
参数 - 默认值为 "none"。或者改成"none".
heatmaply(mat,
dendrogram = "none",
xlab = "", ylab = "",
main = "",
# scale = "column", # <-- remove this line. Or change to "none"
margins = c(60,100,40,20), ...