A customized legend sections the group taxonomy as headers and lists the subgroup taxonomies below each group header, for all the groups.

custom_legend(
  mdf,
  cdf,
  group_level = "Phylum",
  subgroup_level = "Genus",
  x = "Sample",
  y = "Abundance",
  legend_key_size = 0.4,
  legend_text_size = 10,
  legend_orientation = "vertical"
)

Arguments

mdf

data.frame melted dataframe

cdf

data.frame color dataframe

group_level

string of larger taxonomic group

subgroup_level

string of smaller taxonomic group

x

x-value plotted

y

y-value plotted

legend_key_size

numeric determines overall size of the legend keys

legend_text_size

integer determines size of legend text

legend_orientation

string determines vertical or horizontal orientation of legend

Value

complete_legend ggplot

Examples

legend_new <- custom_legend(mdf_GP, cdf_GP)
#> Error in custom_legend(mdf_GP, cdf_GP): object 'mdf_GP' not found