In the heatmap
函数轴的位置是硬编码的。但只需更改一个数字即可将其定位在另一侧,这将非常容易。在控制台中输入“heatmap”,然后将第二个参数从 4 更改为 2axis()
call.
我改变的只是:
axis(2, iy, labels = labRow, las = 2, line = -0.5, tick = 0, # the 2 used to be 4
cex.axis = cexRow)
仍需要更改边距以适应转换。在我正在使用的帮助页面示例中,将当前值 0 更改为 5 似乎可以创建足够的空间:
...
par(mar = c(margins[1L], 5, 0, margins[2L]))
这是我的测试用例:
x <- as.matrix(mtcars)
rc <- rainbow(nrow(x), start=0, end=.3)
cc <- rainbow(ncol(x), start=0, end=.3)
utils::str(hv) # the two re-ordering index vectors
## no dendrogram (nor color strip)
heatmap.new(x, Colv = NA, Rowv=NA, col = cm.colors(256), scale="column",
margins=c(5,2),
xlab = "specification variables", ylab= "Car Models",
main = "heatmap(<Mtcars data>, ..., scale = \"column\")")