I keep getting almost completely black bar plots when subsetting 16s data. Like this:
@syork
I’ve tried reloading and changing browsers, deleting and creating a new container, to no avail. Is there a problem with the code I used?
I keep getting almost completely black bar plots when subsetting 16s data. Like this:
@syork
I’ve tried reloading and changing browsers, deleting and creating a new container, to no avail. Is there a problem with the code I used?
Phyloseq automatically creates a black bar around each ASV in graph so this error usually means that there are so many ASVs (the subset has 11,182 ASVs) that the black outlines around each overlap the actual color underneath. In the bottom of the second graph we can see some of the red Bacteroidales that are probably more abundant.
Usually we avoid this error by setting stat = “identity” but for some reason it isn’t working here.
We can try to get around the problem with tax_glom() which merges all ASVs of the same taxonomic rank into a single group (so only one black outline is added per group) but for some reason that isn’t working either.
# Subset the phylum
my_subset <- subset_taxa(ad, Phylum == "Bacillota")
#tax_glom will combine all of the chosen rank into a single category when plotted. Storing our new glommed data in the object my_subset_glom
my_subset_glom <- tax_glom(my_subset, taxrank="Class")
#Plotting using the glommed data
plot_bar(my_subset_glom, x= "group", fill = "Class", title = "My title") +
geom_bar(aes(color = Class, fill = Class), stat = "identity", position = "stack")
Give me a like if it works or let me know if you continue to have issues.