View source: R/overlayMapping.R
1 | ModOverlay(base, overlay, n)
|
base |
|
overlay |
|
n |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ##---- 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 (base, overlay, n)
{
maxClust = as.numeric(unique(overlay$colors))
if (n == 1) {
manipulate(singleModOverlay(base = base, overlay = overlay,
n = c(mod1), color = c(col1)), mod1 = slider(1, length(maxClust),
label = "First Module"), col1 = picker("Red", "Orange",
"Yellow", "Green", "Blue", "Purple", "Violet", label = "Color of Module"))
}
if (n == 2) {
manipulate(singleModOverlay(base = base, overlay = overlay,
n = c(mod1, mod2), color = c(col1, col2)), mod1 = slider(1,
length(maxClust), label = "First Module"), col1 = picker("Red",
"Orange", "Yellow", "Green", "Blue", "Purple", "Violet",
label = "Color of Module"), mod2 = slider(1, length(maxClust),
label = "Second Module"), col2 = picker("Red", "Orange",
"Yellow", "Green", "Blue", "Purple", "Violet", label = "Color of Module"))
}
if (n == 3) {
manipulate(singleModOverlay(base = base, overlay = overlay,
n = c(mod1, mod2, mod3), color = c(col1, col2, col3)),
mod1 = slider(1, length(maxClust), label = "First Module"),
col1 = picker("Red", "Orange", "Yellow", "Green",
"Blue", "Purple", "Violet", label = "Color of Module"),
mod2 = slider(1, length(maxClust), label = "Second Module"),
col2 = picker("Red", "Orange", "Yellow", "Green",
"Blue", "Purple", "Violet", label = "Color of Module"),
mod3 = slider(1, length(maxClust), label = "Third Module"),
col3 = picker("Red", "Orange", "Yellow", "Green",
"Blue", "Purple", "Violet", label = "Color of Module"))
}
if (n == 4) {
manipulate(singleModOverlay(base = base, overlay = overlay,
n = c(mod1, mod2, mod3, mod4), color = c(col1, col2,
col3, col4)), mod1 = slider(1, length(maxClust),
label = "First Module"), col1 = picker("Red", "Orange",
"Yellow", "Green", "Blue", "Purple", "Violet", label = "Color of Module"),
mod2 = slider(1, length(maxClust), label = "Second Module"),
col2 = picker("Red", "Orange", "Yellow", "Green",
"Blue", "Purple", "Violet", label = "Color of Module"),
mod3 = slider(1, length(maxClust), label = "Third Module"),
col3 = picker("Red", "Orange", "Yellow", "Green",
"Blue", "Purple", "Violet", label = "Color of Module"),
mod4 = slider(1, length(maxClust), label = "Third Module"),
col4 = picker("Red", "Orange", "Yellow", "Green",
"Blue", "Purple", "Violet", label = "Color of Module"))
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.