Show R heatmap outliers in a different colour

前端 未结 2 822
星月不相逢
星月不相逢 2021-01-16 11:37

Looking to mark outliers in R matrix in a different color. Say I have the data as

1  2  4  2  5
5  4  3  2  3
1 500 5  4  2

Now I want to

2条回答
  •  情书的邮戳
    2021-01-16 12:12

    If you want to clearly see the 500, you should specify no scaling. For example,

    m <- matrix(c(1, 5, 1, 2, 4, 500, 4, 3, 5, 2, 2, 4, 5, 3, 2), 
      ncol=5)
    
    heatmap((m<500)+0, scale="none", Rowv=NA, Colv=NA)
    

提交回复
热议问题