Why don't the R color cells work sequentially?

The function heatmapin R should help the person interpret the relative values ​​of the elements of the matrix. However, apparently, it does not color the cells sequentially within the given graph, which is a serious obstacle to the correct interpretation of relative values.

For example, let's generate some data by combining columns of normal random variations:

foo <- cbind(replicate(10,rnorm(10)))

Now, if we match the columns of foo, we can verify that we get 1 in the diagonal elements, since the correlation of any column with itself is 1:

cor.matrix <- cor(foo)

But when building:

heatmap(cor.matrix,Rowv=NA,Colv=NA)

(we suppress the dendrogram entry here, although this does not seem to matter)

the diagonal cells are not colored evenly, as you can see: here

Can anyone explain what is going on here?

+5
source share
1 answer

By default, the temperature scale is scaled by the "line".

heatmap(cor.matrix,Rowv=NA,Colv=NA, scale="none")
+7
source

All Articles