joey711 / joey711.github.com Goto Github PK
View Code? Open in Web Editor NEWOfficial GitHub central page for joey711
Official GitHub central page for joey711
Hi there,
I managed to create a 100% stacked proportional bar chart representing relative abundance of phyla across 3 forest age categories using this code. However, what I want is this relative abundance figure except with only 10 phyla represented, including the 9 most abundant phyla and a 10th category merging all the remaining taxa.
Here's my code so far, where Bacteria_physeq is my phyloseq object and age.category is the variable of interest:
cleaned_phyla = subset_taxa(Bacteria_physeq, Phylum!="NA" & Phylum!="")
cleaned_phyla
otu_table() OTU Table: [ 17566 taxa and 19 samples ]
sample_data() Sample Data: [ 19 samples by 6 sample variables ]
tax_table() Taxonomy Table: [ 17566 taxa by 7 taxonomic ranks ]
Bacteriaphyseq <- psmelt(cleaned_phyla)
barstackprop <- ggplot(Bacteriaphyseq, aes(x = age.category, y = Abundance, fill = Phylum)) +
geom_bar(position = "fill",stat = "identity") +
scale_y_continuous(labels = scales::percent_format()) +
labs(x = "Age category", y = "Relative abundance")
plot(barstackprop)
As you can see, there are far too many colours and phyla represented.
I've tried a couple of tutorials and other forum recommendations but can't seem to get it to work for what I want to achieve here. Any help would be really useful.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.