node labels

23 views
Skip to first unread message

tuffr...@gmail.com

unread,
Feb 26, 2020, 7:59:49 PM2/26/20
to metacoder
Thanks for metacoder - I think the heat trees are a great way to visualize data. 

I'm trying to optimize the node labels. I see how to set the maximum number (e.g. node_label_max = 30), but I don't know how the taxa are ranked to decide which 30 to include. Is there a way to include all nodes that are up to a particular rank? For example, include phylum, class, order ranks. 


Zachary Foster

unread,
Feb 26, 2020, 10:02:25 PM2/26/20
to metacoder

Thanks!

If you limit the node labels with node_label_max, it picks the biggest labels. You can show specific labels like so:

library(metacoder)

x = parse_tax_data(hmp_otus, class_cols = "lineage", class_sep = ";",
                   class_key = c(tax_rank = "taxon_rank", tax_name = "taxon_name"),
                   class_regex = "^(.+)__(.+)$")

heat_tree(x,
          node_label = ifelse(taxon_ranks %in% c('r', 'p', 'c'), taxon_names, ''),
          node_size = n_obs,
          node_color = n_obs)

heat_tree(x,
          node_label = ifelse(n_supertaxa < 3, taxon_names, ''),
          node_size = n_obs,
          node_color = n_obs)

Let me know if you need more help.

Best,

Zach
Reply all
Reply to author
Forward
0 new messages