Description Usage Arguments Details Value Note Author(s) Examples
This function modifies a given color vector as used for heatmaps.
1 | heatmapCol(data, col, lim, na.rm = TRUE)
|
data |
matrix or data.frame; data which shall be displayed in a heatmap; ranging from negative to positive numbers. |
col |
vector of colors used for heatmap. |
lim |
constant colors are used for data below |
na.rm |
logical; remove |
Colors below and above a specified value are kept constant. In addition, the colors are symmetrizised.
vector of colors
A first version of this function appeared in package SLmisc.
Matthias Kohl Matthias.Kohl@stamats.de
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | data.plot <- matrix(rnorm(100*50, sd = 1), ncol = 50)
colnames(data.plot) <- paste("patient", 1:50)
rownames(data.plot) <- paste("gene", 1:100)
data.plot[1:70, 1:30] <- data.plot[1:70, 1:30] + 3
data.plot[71:100, 31:50] <- data.plot[71:100, 31:50] - 1.4
data.plot[1:70, 31:50] <- rnorm(1400, sd = 1.2)
data.plot[71:100, 1:30] <- rnorm(900, sd = 1.2)
nrcol <- 128
require(RColorBrewer)
myCol <- rev(colorRampPalette(brewer.pal(10, "RdBu"))(nrcol))
heatmap(data.plot, col = myCol, main = "standard colors")
myCol2 <- heatmapCol(data = data.plot, col = myCol,
lim = min(abs(range(data.plot)))-1)
heatmap(data.plot, col = myCol2, main = "heatmapCol colors")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.