Improving the appearance of a stacked barchart with ggplot2, dplyr, and forcats (CC103)
11,828
Published 2021-05-12
Pat will use RStudio and functions from the tidyverse including #ggplot2, #dplyr, and #forcats packages. The accompanying blog post can be found at www.riffomonas.org/code_club/2021-05-12-stacked-ba….
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 [email protected]!
R: r-project.org/
RStudio: rstudio.com/
Raw data: github.com/riffomonas/raw_data/releases/latest
Workshops: www.mothur.org/wiki/workshops
You can also find complete tutorials for learning R with the tidyverse using...
Microbial ecology data: www.riffomonas.org/minimalR/
General data: 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
All Comments (17)
-
Without using a different chart type, what else would you do to improve the appearance of these stacked bar charts?
-
Interesting, I'm back to R and study how write code, this video is useful for start to make charts with weather information, thanks for your video was very helpful.
-
Thanks for sharing these.very helpful!!
-
amazing videos! glad I found your stuff! greetings from germany :)
-
Well, the.beauty of you presentations is that you not only learn R.... Actually, what I learn is English😃😃
-
Love stacked bar charts! What alternative do you prefer?
-
great video. Thanks
-
THE MANNNNNNN thanks a lot
-
Nice vid!
-
nice vid
-
Thank you so much for your lectures. They really help me understand the basics of R. I have a questions concerning barcharts in ggplot2. Is there a way to place the bars and tick labels between the tick marks rather than on them? This is possible in excel. It will be nice to replicate that in R
-
Thanks a lot! Is there a way (not manually) to reorder the stacked bar plots in a specific/ascending order of the most abundant taxa (Firmicutes)? Leaving Healthy on the left, changing the position of Diarrhea pos. to middel and Diarrhea neg. to the right?
-
Thank you for the video. What will we do if we want to sort bar in order. For example, we want to put Fermicute at the bottom and the mean will increase in the order : Healthy, Diarrhea C difficile positive, and Diarrhea C difficile negative ?
-
Would it be better to separate the phyla into their own graphs and look at them separately? Like different facets or grids? One for each Phyla?
-
how we calculate percentage of each sample.. can you tell me..?
-
Great videos! You can simplify the pooling of taxa with forcats::fct_lump functions into one step, which I find really handy.