
As the above screenshot showed, I used the function heatmap.2() here.
how can I change ‘Value‘ in the color coded bar to any other name?
One can just use the data from gplots package:
library(gplots)
data(mtcars)
x <- as.matrix(mtcars)
rc <- rainbow(nrow(x), start=0, end=.3)
cc <- rainbow(ncol(x), start=0, end=.3)
heatmap.2(x, key=TRUE)
Many thanks 🙂
It’s hard-coded. You will need to change it in the code. It appears about midway down the section that draws the key and the line is:
This is the section of the heatmap.2 code that creates the key (at least up to the point where the word “Value” appears) :
You should type
heatmap.2, then copy the source code to an editor and then use the search function to find “Value”. Change “Value” to something else (in quotes) and then typeheatmap.2 <-and paste in the code and hit return. (Unless you save this it will only persist as long as the session continues.)