热图中的白色区域由R
问题描述:
我的热图图有一个奇怪的问题,它有白色区域,但我从未指定白色。热图中的白色区域由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)
白色区域是什么意思?我认为这与我的数据有关,可能是什么问题?
在此先感谢。
答
因为你设置为从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)
color.palette <- colorRampPalette(c("green", "black", "blue"))(length(palette.half) -1)
h.all(m , scale="none",breaks=palette.half,col=color.palette)
+0
你是对的@ SimonO101。默认热图不知道如何知道这一点。我使用了“heatmap.2”(gplots),它起作用,超出范围的值与范围值相同。 – shao 2013-03-14 08:54:07
NA值可能? – 2013-03-13 23:53:57
@KonradRudolph更可能是用于定义'colour.palette'的'quantile.range'我认为 – 2013-03-14 00:37:09