grunwaldlab / metacoder

Parsing, Manipulation, and Visualization of Metabarcoding/Taxonomic data
http://grunwaldlab.github.io/metacoder_documentation
Other
135 stars 28 forks source link

Adding/Removing the Node/Edge legends individually. #202

Closed grabear closed 6 years ago

grabear commented 6 years ago

An option like _makelegend = FALSE could exist for the edge legend and for the node legend separately. Currently, the _makelegend parameter controls both. In some cases you might only want one or the other. This might help save space in reference to file size and the plot dimensions.

So in the heat_tree function, there could be a _make_nodelegend parameter and a _make_edgelegend parameter.

I know that implementing this might span across several scripts. If you could point me in the right direction, I would be happy to add this.

zachary-foster commented 6 years ago

Hello @grabear, thanks for the suggestion and offer to help!

This was a pretty easy change, so I just when ahead and did it.

Install the dev versions and try:

devtools::install_github("ropensci/taxa")
devtools::install_github("grunwaldlab/metacoder")

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

heat_tree(x, node_label = taxon_names, node_size = n_obs, node_color = n_obs, edge_size = n_obs + 1)
heat_tree(x, node_label = taxon_names, node_size = n_obs, node_color = n_obs, edge_size = n_obs + 1, make_node_legend = FALSE)
heat_tree(x, node_label = taxon_names, node_size = n_obs, node_color = n_obs, edge_size = n_obs + 1, make_edge_legend = FALSE)
heat_tree(x, node_label = taxon_names, node_size = n_obs, node_color = n_obs, edge_size = n_obs + 1, make_edge_legend = FALSE, make_node_legend = FALSE)
grabear commented 6 years ago

No problem! This package is awesome, so I'm excited to contribute once I finish the project I'm working on with metacoder. Nice update!

zachary-foster commented 6 years ago

Thanks!