title: Stack bar generated by Phyloseq
body: <p>I am using this R package called "phyloseq" to analyze the bioinformatic data.</p>
  
  <pre><code>otumat = matrix(sample(1:100, 100, replace = TRUE), nrow = 10, ncol = 10)
  otumat
  
  rownames(otumat) &lt;- paste0("OTU", 1:nrow(otumat))
  colnames(otumat) &lt;- paste0("Sample", 1:ncol(otumat))
  otumat
  
  taxmat = matrix(sample(letters, 70, replace = TRUE), nrow = nrow(otumat), ncol = 7)
  rownames(taxmat) &lt;- rownames(otumat)
  colnames(taxmat) &lt;- c("Domain", "Phylum", "Class", "Order", "Family", "Genus", 
                        "Species")
  taxmat
  
  library("phyloseq")
  OTU = otu_table(otumat, taxa_are_rows = TRUE)
  TAX = tax_table(taxmat)
  OTU
  TAX
  
  physeq = phyloseq(OTU, TAX)
  physeq
  
  plot_bar(physeq, fill = "Family")
  </code></pre>
  
  <p>So the bar graph generated do not stack the same Family together. For example, there are two separate "I" blocks in sample 10. I know phyloseq plot graph using ggplot2. Does any one know what ggplot2 associated codes I can add to the lot_bar(physeq, fill = "Family") to stack the same family together in the bar graph?</p>
  
  <p><a href="https://i.stack.imgur.com/qZd1M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qZd1M.png" alt="enter image description here"></a></p>