I'm generating clustering heatmap with heatmap.2
function (R gplots package). I'd like to add a vertical line(s) onto the image at variable location(s) using add.expr
parameter.
For example,
xx=replicate(10, rnorm(10)) # some random matrix
heatmap.2(xx, trace="none",
add.expr=abline(v=c(3.5,6.5), lwd=3))
This works great. The problem is it doesn't work if I pass the lines location as a variable:
linePosition = c(3.5,6.5)
heatmap.2(...,
add.expr=abline(v=linePosition, lwd=3))
It looks like abline
function is called from inside the heatmap.2 function and doesn't see the external variables.
Please advice what would be the best approach.
Of course, I don't want to modify any of the functions except my own.
This seems to add the two thick lines:
heatmap.2(xx,
add.expr=eval( abline(v=linePosition, lwd=3)))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.