When creating a heatmap with heatmaply::heatmaply()
, some transforms are performed on the raw data. 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.
https://i.sstatic.net/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]
:
https://i.sstatic.net/nuMcn.png
How can heatmaply::heatmaply()
be made to generate a heatmap based purely on the raw values provided (no transformations)?
Note: open to using other packages/functions/suggestions
Remove the scale
argument - the default is "none". 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), ...