1

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.

4

1 回答 1

3

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) ).

于 2013-08-23T21:44:02.650 回答