我正在尝试使用 R 语言绘制热图。
绘制热图图表后,我发现我的热图不适合解释,因为颜色键的范围没有调整好。
正如您在下面看到的,与我的数据分布相比,颜色键范围非常长。(它们在零到四之间)。因此,热图中的所有颜色都是绿色的。
如何解决这些问题?
以下是我的代码。(我试图搜索解决方案,但我没有找到适合我的案例的线程。)
library(gplots)
matrix <- as.matrix(read.delim("bladder",header=FALSE))
hclustfunc <- function(x) hclust(x, method="complete")
distfunc <- function(x) dist(x, method="euclidean")
cl.col <- hclustfunc(distfunc(t(matrix)))
gr.col <- cutree(cl.col, 4)
heatmap.2(as.matrix(matrix),col=greenred(75),dendrogram=c("col"),trace="none",Rowv=FALSE,margins = c(8,16),cexRow=0.60,cexCol=0.8)