if (FALSE) {
dend <- iris[1:40, -5] %>%
dist() %>%
hclust() %>%
as.dendrogram() %>%
set("branches_k_color", k = 3) %>%
set("branches_lwd", c(5, 2, 1.5)) %>%
set("branches_lty", c(1, 1, 3, 1, 1, 2)) %>%
set("labels_colors") %>%
set("labels_cex", c(.9, 1.2)) %>%
set("nodes_pch", 19) %>%
set("nodes_col", c("orange", "black", "plum", NA))
circlize_dendrogram(dend)
circlize_dendrogram(dend, labels = FALSE)
circlize_dendrogram(dend, facing = "inside", labels = FALSE)
# In the following we get the dendrogram but can also get extra information on top of it
circos.initialize("foo", xlim = c(0, 40))
circos.track(ylim = c(0, 1), panel.fun = function(x, y) {
circos.rect(1:40 - 0.8, rep(0, 40), 1:40 - 0.2, runif(40), col = rand_color(40), border = NA)
}, bg.border = NA)
circos.track(ylim = c(0, 1), panel.fun = function(x, y) {
circos.text(1:40 - 0.5, rep(0, 40), labels(dend),
col = labels_colors(dend),
facing = "clockwise", niceFacing = TRUE, adj = c(0, 0.5)
)
}, bg.border = NA, track.height = 0.1)
max_height <- attr(dend, "height")
circos.track(ylim = c(0, max_height), panel.fun = function(x, y) {
circos.dendrogram(dend, max_height = max_height)
}, track.height = 0.5, bg.border = NA)
circos.clear()
}
Run the code above in your browser using DataLab