简体   繁体   English

无法删除热图上的树状图和聚类 R

[英]Can't delete dendogram and clustering on heatmap R

I've got the following function on R. The idea is to receive a vector of length 400 with values between 0 and 1 and to create a heatmap with those values.我在 R 上有以下 function。我的想法是接收长度为 400 且值介于 0 和 1 之间的向量,并使用这些值创建热图。

display_pattern <- function(x){
  x <- unlist(x)
  mat <- matrix(x, 20, byrow=T)
  heatmap(mat, Rowv=FALSE, Colv=FALSE)
}

If I call the function outside and try it with an example, the heatmap appears but Rowv and Colv don't seem to work.如果我在外面调用 function 并尝试使用示例,则会出现热图,但 Rowv 和 Colv 似乎不起作用。

display_pattern(patterns[257,1:400])

With the function随 function

I've also tried putting the code outside the function, and the result is what I would like it to be, which is this:我也试过把代码放在 function 之外,结果是我想要的,就是这样的:

heatmap(matrix(unlist(patterns[257,1:400]), 20, byrow=T), Rowv=NA, Colv=NA)

Outside the function外线 function

How could I fix it?我该如何解决? Thanks in beforehand提前致谢

Your two heatmap statements (inside and outside the function) are different.您的两个热图语句(函数内部和外部)不同。 Outside the function, you correctly used Rowv=NA, Colv=NA .在 function 之外,您正确使用Rowv=NA, Colv=NA Inside the function, you incorrectly used Rowv=FALSE, Colv=FALSE在 function 里面,你错误地使用Rowv=FALSE, Colv=FALSE

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

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