简体   繁体   中英

R - heatmap.2 log scale

Is there a way to use a log scale for heatmap.2 or do I have to log the data beforehand before the plot? Currently, I have a 50 x 50 matrix with really big numbers and so my heatmap is showing very little depth.

What's the problem with just taking logs beforehand? It's as simple as...

m<- matrix( sample( c(10,100,1000) , 16 , repl = TRUE ) , 4 , 4 )
#     [,1] [,2] [,3] [,4]
#[1,]   10   10  100  100
#[2,]  100   10  100 1000
#[3,]  100 1000  100  100
#[4,]  100   10   10 1000

log10(m)
#     [,1] [,2] [,3] [,4]
#[1,]    1    1    2    2
#[2,]    2    1    2    3
#[3,]    2    3    2    2
#[4,]    2    1    1    3

Or indeed require( gplots ); heatmap.2( log10(m) ) require( gplots ); heatmap.2( log10(m) ) .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM