Labs(y = "Relative abundance", x = "Site age since restoration (years)") + Scale_y_continuous(labels = scales::percent_format()) + Geom_bar(aes(), stat="identity", position="fill") + (Sample, levels = level_order)), Sample) plot graphī_ra_cont <- ggplot(Bacteriaphyseq, aes(x=Sample, y=Abundance, fill=Phylum)) + "NelBoT", "TauMcB", "HamMin", "ChrRic", "NplHrs","HamCla", "InvKBR", "WelOWR")īacteriaphyseq <- arrange(transform(Bacteriaphyseq, Sample = factor Level_order <- c("NelMRY", "WelOCH", "DunIsP", "InvWaR", "TauCaP", "ChrMrs", "HamAva", "NplPer", "InvEsW", "WelMtA", "DunSiH", (restoration_status, levels = restoration_status_order)), Restoration_status_order <- c("restored", "remnant")īacteriaphyseq <- arrange(transform(Bacteriaphyseq, restoration_status = factor Levels(Bacteriaphyseq$restoration_status) reorder facets by restored first and remnant second But I don't want to show the site codes on the graph, I want to show age along the x axis so it is simple to view, hence scale_x_discrete is labelling the site codes with their actual age in years,Īny help would be greatly appreciated! Cannot for the life of me find a solution which involves removing the x axis labels/inputting nothing into the x axis labels for just one facet. "Sample" contains the site codes and "level_order" is ordering them from youngest to oldest restored forests along the x axis. The variable "restoration_status" in my excel sheet groups the sites into either the restored or remnant category. I m using a phyloseq object called Bacteriaphyseq in this example containing Bacterial OTU data. I could of course just edit over top of this in Inkscape but would like a way of coding this in. I want the x axis in the remnant facet to be blank. However, the age for the restored facets is repeating automatically into the remnant facet when I use facet_grid. Using cowplot to create multiple plots in one figure. There are still other things you can do with facets, such as using space 'free'.The Cookbook for R facet examples have even more to explore. I'm looking at Bacterial relative abundance in restored forests with 3 remnant forests in a separate facet. ggplot2 with facet labels as the y axis labels.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |