Skip to content

Make standard stacked barcharts #105

Open
@zachary-foster

Description

@zachary-foster

This would take a taxmap as input and return a ggplot2 graph. The dataset would typically be the result of soemthing like calc_taxon_abund

stacked_barchart(obj, dataset, cols = NULL, groups = NULL, ranks = NULL)

dataset, cols and groups would work like those options in functions like calc_taxon_abund. The same parsers for those options should be reused.

ranks would take two types of input:

  • character: The names of ranks (e.g. ranks = "genus")
  • numeric: The "depth" of the rank from the root (e.g. rank = 4)

If multiple values for ranks is given, then one stacked barchart for each rank will be produced and combined into the same graph using ggplot2 facets or cowplot. If ranks is NULL, then the finest rank should be picked such that >90% of the bar is split into fewer than 10 colors with an "other" group (grey) added for the extra 10%. If the taxmap has rank info (e.g. taxon_ranks(obj)) then a named rank will be picked. Otherwise, a "depth" of the rank from the root will be picked. This function should not be allowed to print more than 10 colorsl.

phyloseq already has a barchart function:

https://joey711.github.io/phyloseq/plot_bar-examples.html

So this would mainly be a convenience for using taxmap objects instead of phyloseq objects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions