View source: R/Heatmap_Legend.R
1 | Heatmap_Legend(colvec, heatrange, margintext = NULL)
|
colvec |
|
heatrange |
|
margintext |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (colvec, heatrange, margintext = NULL)
{
par(xaxs = "i", yaxs = "i", mar = c(1, 0, 1, 2 + ifelse(is.null(margintext),
0, 1.5)), mgp = c(1.5, 0.25, 0), tck = -0.02)
N = length(colvec)
Y = seq(heatrange[1], heatrange[2], length = N + 1)
plot(1, type = "n", xlim = c(0, 1), ylim = heatrange, xlab = "",
ylab = "", main = "", xaxt = "n", yaxt = "n", cex.main = 1.5)
for (i in 1:N) polygon(x = c(0, 1, 1, 0), y = Y[c(i, i, i +
1, i + 1)], col = colvec[i], border = NA)
axis(side = 4, at = pretty(heatrange))
if (!is.null(margintext))
mtext(side = 4, text = margintext, line = 2, cex = 1.5)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.