How to add significance lines and stars to a faceted figure in R with ggplot2 (CC095)
Channel: Riffomonas Project
Date: 2021-04-23

Ever wonder how to add lines and stars to a plot to indicate significance to a faceted plot? That's what we'll cover in this episode of Code Club! Pat will modify an existing figure to make it faceted using facet_wrap and facet_grid and then show how to add significance lines and stars at different positions for each panel of the figure using geom_segment and geom_text.

Pat will use RStudio and functions from the #ggplot2 package including #facet_wrap, #geom_segment, #geom_text, and other packages from the tidyverse. The accompanying blog post can be found at https://www.riffomonas.org/code_club/2021-04-23-faceted-bars-stars.

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
1:47 Revisiting plot with significance bars and stars
4:04 Creating faceted figure
9:45 Adding significance lines 
16:07 Adding significnace labels
18:16 Adjusting the order of the panels
19:00 Why does this work?