Improving the appearance of a stacked barchart with ggplot2, dplyr, and forcats (CC103)
Channel: Riffomonas Project
Date: 2021-05-12

Sometimes we don't have a choice in the type of data visualization format we use. Although a stacked barchart is not ideal, there are methods for improving the appearance of stacked barcharts. In this episode of Code Club, Pat uses ggplot2, dplyr, and forcats to show how to pool rare taxa and order the more abundant taxa to give a common anchor point on the y-axis to make comparisons.


Pat will use RStudio and functions from the tidyverse including #ggplot2, #dplyr, and #forcats packages. The accompanying blog post can be found at https://www.riffomonas.org/code_club/2021-05-12-stacked-barchart-2.

Do you have a figure that you would like to receive a critique or help improving? Let me know and I'd be happy to arrange a guest appearance!

If you're interested in taking an upcoming 3 day R workshop, email me at riffomonas@gmail.com!

R: https://r-project.org
RStudio: https://rstudio.com
Raw data: https://github.com/riffomonas/raw_data/releases/latest
Workshops: https://www.mothur.org/wiki/workshops

You can also find complete tutorials for learning R with the tidyverse using...
Microbial ecology data: https://www.riffomonas.org/minimalR/
General data: https://www.riffomonas.org/generalR/

0:00 Introduction
4:16 Pooling rare phyla
8:36 Specifying order of stacked bars w/ help of forcats
14:41 Changing colors and appearance of legend
17:33 Making bars sit on x-axis
18:15 Critique of figure
21:28 Recap