-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathvocabulary.Rmd
41 lines (30 loc) · 1.28 KB
/
vocabulary.Rmd
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
```{r}
obj <- taxmap(taxon_ids = LETTERS[1:18],
supertaxon_ids = c(NA, "A", "A", "A", "B", "B", "C", "C", "D", "F", "F", "K",
"J", "J", "H", "H", "I", "G"))
plot_one <- function(obj, subset, highlight, title = deparse(match.call()[[3]])) {
ids <- obj$taxon_data$taxon_ids
vc <- rep("#EEEEEE", length(ids))
vc[ids == highlight] <- "#999999"
vc[ids %in% subset[[1]]] <- "lightblue"
obj$taxon_data$my_vc <- vc
heat_tree(obj, node_label = taxon_ids,
node_color = my_vc,
make_legend = FALSE,
edge_color = "#EEEEEE",
node_size = 1 / n_supertaxa,
node_size_range = c(0.06, NA),
title = title,
title_size = 0.05,
node_color_range = c("#555555", "#EEEEEE"))
}
gridExtra::grid.arrange(ncol = 4, nrow = 1,
plot_one(obj, supertaxa(obj, "F", recursive = FALSE),
highlight = "F", "Parent"),
plot_one(obj, supertaxa(obj, "F"),
highlight = "F", "Supertaxa"),
plot_one(obj, subtaxa(obj, "F", recursive = FALSE),
highlight = "F", "Children"),
plot_one(obj, subtaxa(obj, "F"),
highlight = "F", "Subtaxa"))
```