R pheatmap:在图例中使用对数缩放
R pheatmap: use logarithmic scaling in the legend
我有一个矩阵
library(pheatmap)
set.seed(1)
mat <- matrix(rexp(200, rate=.001), ncol=20)
pheatmap(mat)
并且有一个值比其他值高很多。因此,我想对图例条使用对数缩放(1、10、100、1000,...)。
有没有可能用 pheatmap
包做到这一点?
编辑:我不想log(mat)
,我只希望颜色缩放条按对数缩放(1、10、100、1000,...)。
只需添加对数 legend_breaks
并显示最大值标签。
pheatmap::pheatmap(mat, legend_breaks=c(10^(0:ceiling(log10(max(mat)))),
round(max(mat), 2)))
屈服
我有一个矩阵
library(pheatmap)
set.seed(1)
mat <- matrix(rexp(200, rate=.001), ncol=20)
pheatmap(mat)
并且有一个值比其他值高很多。因此,我想对图例条使用对数缩放(1、10、100、1000,...)。
有没有可能用 pheatmap
包做到这一点?
编辑:我不想log(mat)
,我只希望颜色缩放条按对数缩放(1、10、100、1000,...)。
只需添加对数 legend_breaks
并显示最大值标签。
pheatmap::pheatmap(mat, legend_breaks=c(10^(0:ceiling(log10(max(mat)))),
round(max(mat), 2)))
屈服