r - Passing parameter to function in add.expr inside heatmap.2 -
i'm generating clustering heatmap heatmap.2 function (r gplots package). i'd add vertical line(s) onto image @ variable location(s) using add.expr parameter.
for example,
xx=replicate(10, rnorm(10)) # random matrix heatmap.2(xx, trace="none", add.expr=abline(v=c(3.5,6.5), lwd=3)) this works great. problem doesn't work if pass lines location variable:
lineposition = c(3.5,6.5) heatmap.2(..., add.expr=abline(v=lineposition, lwd=3)) it looks abline function called inside heatmap.2 function , doesn't see external variables.
please advice best approach.
of course, don't want modify of functions except own.
this seems add 2 thick lines:
heatmap.2(xx, add.expr=eval( abline(v=lineposition, lwd=3)))
Comments
Post a Comment