[英]Can't delete dendogram and clustering on heatmap R
我在 R 上有以下 function。我的想法是接收長度為 400 且值介於 0 和 1 之間的向量,並使用這些值創建熱圖。
display_pattern <- function(x){
x <- unlist(x)
mat <- matrix(x, 20, byrow=T)
heatmap(mat, Rowv=FALSE, Colv=FALSE)
}
如果我在外面調用 function 並嘗試使用示例,則會出現熱圖,但 Rowv 和 Colv 似乎不起作用。
display_pattern(patterns[257,1:400])
我也試過把代碼放在 function 之外,結果是我想要的,就是這樣的:
heatmap(matrix(unlist(patterns[257,1:400]), 20, byrow=T), Rowv=NA, Colv=NA)
我該如何解決? 提前致謝
您的兩個熱圖語句(函數內部和外部)不同。 在 function 之外,您正確使用Rowv=NA, Colv=NA
。 在 function 里面,你錯誤地使用Rowv=FALSE, Colv=FALSE
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.