pheatmap: Color for NA

前端 未结 5 1705
梦谈多话
梦谈多话 2021-02-05 17:41

Using R package pheatmap to draw heatmaps. Is there a way to assign a color to NAs in the input matrix? It seems NA gets colored in white by default. E.g.:

libra         


        
5条回答
  •  难免孤独
    2021-02-05 18:28

    If you want the NAs to be grey, you can simply force the "NA" as double.

    m[is.na(m)] <- as.double("NA")
    pheatmap(m, cluster_rows=F, cluster_cols=F)
    

提交回复
热议问题