Reputation: 1293
Dear stackoverflow community, I have generated a heatmap on a random matrix from the following R code. I am having trouble interpreting the Color Key and Histogram at the top-left of the plot.
library("gplots")
library("RColorBrewer")
m<-matrix(rexp(200, rate=.1), ncol=20)
colors <- colorRampPalette( rev(brewer.pal(11, "RdYlGn")) )(255)
heatmap.2(m, col=colors, trace="none", Rowv=FALSE)
What do the x and y axis mean in the Color Key and Histogram?
Also, I noticed that I am able to scale the data row or column wise with the scale
argument. For example:
heatmap.2(m, col=colors, scale="row", trace="none", Rowv=FALSE)
How should I interpret the row z-score?
Thank you all in advance!
Upvotes: 2
Views: 4635
Reputation: 8631
It is simply a histogram of all the values you have in your matrix m
(value vs frequency) and how they correspond to the specified heatmap colour range. Using the scale
argument, you have transformed each value in m
to a row Z-score, or the number of standard deviations above or below the mean of its row. This gives a distribution centred around the midpoint of the colour scale, so the heatmap has more contrast and is easier to interpret.
To check your heatmap gives optimal detail and interpretability, you can turn on trace
and check that the lines go to either the very top and bottom (or the far left and far right) of a decent proportion of the tiles.
Upvotes: 1