我想显示自定义范围breaks
:
breaks=seq(0, 1500, by=20)
显示在颜色键中。有没有办法手动设置颜色键的范围?
heatmap.3(x, Rowv=T, Colv=F, col=mycol, RowSideColors=custom.annotation, scale="none", trace="none", dendrogram="row", breaks=breaks, cexRow=1, cexCol=1, key=T, main="Heatmap of raw seq reads", na.rm=TRUE)
编辑:
这是一个粗糙的解决方案,但我最终改变了代码本身。星号之间显示的修改。
if (key) {
# par(mar = c(5, 4, 2, 1), cex = 0.75)
par(mar = c(5, 4, 2, 1), cex = 1)
tmpbreaks <- breaks
if (symkey) {
max.raw <- max(abs(c(x, breaks)), na.rm = TRUE)
min.raw <- -max.raw
tmpbreaks[1] <- -max(abs(x), na.rm = TRUE)
tmpbreaks[length(tmpbreaks)] <- max(abs(x), na.rm = TRUE)
}
else {
# min.raw <- min(x, na.rm = TRUE) # original code
# max.raw <- max(x, na.rm = TRUE) # original code
******************************
if(length(breaks)>10){ # if custom breaks, then set min/max to min/max of breaks, etc
min.raw <- min(breaks, na.rm = TRUE)
max.raw <- max(breaks, na.rm=TRUE)
}else{ # else, set min, max to min/max of values
min.raw <- min(x, na.rm = TRUE)
max.raw <- max(x, na.rm = TRUE)
}
******************************
}
答案 0 :(得分:0)
if (key) {
# par(mar = c(5, 4, 2, 1), cex = 0.75)
par(mar = c(5, 4, 2, 1), cex = 1)
tmpbreaks <- breaks
if (symkey) {
max.raw <- max(abs(c(x, breaks)), na.rm = TRUE)
min.raw <- -max.raw
tmpbreaks[1] <- -max(abs(x), na.rm = TRUE)
tmpbreaks[length(tmpbreaks)] <- max(abs(x), na.rm = TRUE)
}
else {
# min.raw <- min(x, na.rm = TRUE) # original code
# max.raw <- max(x, na.rm = TRUE) # original code
******************************
if(length(breaks)>10){ # if custom breaks, then set min/max to min/max of breaks, etc
min.raw <- min(breaks, na.rm = TRUE)
max.raw <- max(breaks, na.rm=TRUE)
}else{ # else, set min, max to min/max of values
min.raw <- min(x, na.rm = TRUE)
max.raw <- max(x, na.rm = TRUE)
}
******************************
}