简体   繁体   中英

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.

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.

display_pattern(patterns[257,1:400])

With the 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:

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

Outside the 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 . Inside the function, you incorrectly used Rowv=FALSE, Colv=FALSE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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