2013-03-13 123 views
2

我的熱圖圖有一個奇怪的問題,它有白色區域,但我從未指定白色。熱圖中的白色區域由R

# cluster.in.da is my data 
cluster.in.da <- t(scale(t(cluster.in.da))) 
quantile.range <- quantile(cluster.in.da, probs = seq(0, 1, 0.01)) 
palette.breaks <- seq(quantile.range["5%"], quantile.range["95%"], 0.01) 
color.palette <- colorRampPalette(c("green", "black", "blue"))(length(palette.breaks) - 1) 
heatmap(cluster.in.da,scale="none",breaks=palette.breaks,col=color.palette) 

白色區域是什麼意思?我認爲這與我的數據有關,可能是什麼問題?

在此先感謝。

enter image description here

+1

NA值可能? – 2013-03-13 23:53:57

+0

@KonradRudolph更可能是用於定義'colour.palette'的'quantile.range'我認爲 – 2013-03-14 00:37:09

回答

4

因爲你設置爲從5-95%分位數的限制打破它是最有可能。 R不知道在該範圍之外分配值的顏色。例如...

#No NA's in the data 
m <- matrix(rnorm(100) , nrow = 10) 
quantile.range <- quantile(m , probs = seq(0, 1, 0.01)) 
palette.all <- seq(quantile.range["0%"], quantile.range["100%"], 0.01) 
palette.half <- seq(quantile.range["50%"], quantile.range["100%"], 0.01) 


color.palette <- colorRampPalette(c("green", "black", "blue"))(length(palette.all) -1) 
h.all(m , scale="none",breaks=palette.all,col=color.palette) 

enter image description here

color.palette <- colorRampPalette(c("green", "black", "blue"))(length(palette.half) -1) 
h.all(m , scale="none",breaks=palette.half,col=color.palette) 

enter image description here

+0

你是對的@ SimonO101。默認熱圖不知道如何知道這一點。我使用了「heatmap.2」(gplots),它起作用,超出範圍的值與範圍值相同。 – shao 2013-03-14 08:54:07