Skip to content

Instantly share code, notes, and snippets.

View mshamash's full-sized avatar

Michael Shamash mshamash

View GitHub Profile
@mshamash
mshamash / stacked_bar_plot-colour_per_phylum_and_species.R
Created October 9, 2021 20:33
Code snippet for generating stacked bar plots, coloured according to species with a unique gradient of colours depending on the phylum
sub <- "MySubjectID"
taxa <- mag_abundance_table %>%
filter(subject == sub & relabund > 0.001) %>%
ungroup() %>%
mutate(phylum = as.factor(phylum),
species = fct_reorder(species, 10*as.integer(phylum)))
colours <- PrepareColours(taxa)