View source: R/ggtree_function_extensions.R
add_clades_to_tree | R Documentation |
Given a named vector of internal tree nodes and labels (e.g. cluster number / name), move through each cluster name and apply geom_hilight and geom_cladelabel from ggtree onto the tree, with alternating shades of grey from top to bottom.
add_clades_to_tree(
drawn_tree,
clade_labels,
highlight_clades = TRUE,
aligned = TRUE,
extend_to_value = 0,
highlight_alpha = 0.4,
label_offset = 0,
gradient = F,
gradient_direction = "tr"
)
drawn_tree |
ggtree object for labels to be added to |
clade_labels |
Named vector of internal node and label (as names), e.g. output from micro.gen.extra::get_clade_nodes() |
highlight_clades |
TRUE/FALSE as to whether to include the ggtree::geom_hilight [Default = TRUE] |
aligned |
TRUE/FALSE as to whether the ggtree::geom_hilights should align [Default = TRUE] |
extend_to_value |
Value to extend the ggtree::geom_hilight to. Float. [Default = 0.0] |
highlight_alpha |
Value to set the alpha of the ggtree::geom_hilight. Set between 0 and 1. [Default = 0.4] |
label_offset |
Value to offset the labels of the clade_labels. [Default = F] |
gradient |
T/F for whether hilighted box should have a gradient (one of "rt" or "tr" [root-to-tip or tip-to-root]) [Default = "tr"] |
gradient_drcton |
Gradient direction [Default = 0.0] |
ggtree object with clades (corresponding to the internal nodes supplied) have been highlighted and labelled.
add_clades_to_tree(ggtree_object, clade_labels_vector)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.