如何在热图中绘制直线

use*_*475 3 plot r

我正在为一些数据制作热图,并希望在每组样本之间添加一条直线.看起来abline效果不好heatmap.

知道我可以用于此目的的功能吗?

Qua*_*bex 6

你必须使用这个add.expr论点.这个例子发现这里可能是有用的:

x  <- as.matrix(mtcars)
rc <- rainbow(nrow(x), start=0, end=.3)
cc <- rainbow(ncol(x), start=0, end=.3)
hv <- heatmap(x, col = cm.colors(256), scale="column",
               RowSideColors = rc, ColSideColors = cc, margin=c(5,10),
               xlab = "specification variables", ylab= "Car Models",
               main = "heatmap(<Mtcars data>, ..., scale = \"column\")",
               # IMPORTANT BIT HERE
               add.expr = abline(h=5, v=2))
Run Code Online (Sandbox Code Playgroud)