Set 0-point for pheatmap in R

前端 未结 2 1338
陌清茗
陌清茗 2021-02-07 20:54

How can you set the 0-point on the color scale to white in this heatmap? Does it use the breaks parameter?

In the following code, white is set to 3 (or near

2条回答
  •  失恋的感觉
    2021-02-07 21:30

    Here's a generic solution similar to @Megatron but a little easier to program. It basically set the minimum and maximum color scale values to be equal in magnitude.

    range <- max(abs(matrix));
    pheatmap(matrix, breaks = seq(-range, range, length.out = 100))
    

提交回复
热议问题