How to create Multi-Panel plots in R with facet_wrap() and facet_grid()

Published 2023-07-14
In this video, I will show you how to use facet_wrap or facet_grid to create multi-panel plots in R and ggplot.
Faceting plots can be very helpful to compare your data over different categories.
It can also help you to get a quick overview of your data across multiple variables if you use a special pivot longer trick.

⏱ Time Stamps ⌚
0:00 - Intro
1:20 - gapminder example
5:09 - facet_wrap arguments
9:35 - facet_grid
13:54 - pivot_longer trick
22:02 - ggarrange

External Links:
www.r-bloggers.com/2018/03/diamonds-and-faceting-a…
www.r-bloggers.acom/2023/02/save-space-in-faceted-…

All Comments (8)
  • Great in-depth video, excellent content.
  • @icefunkdark8555
    This video is so useful. Thank you so much for sharing :) Appreciate the content and time.
  • @GaboMoya
    I have a question. How do u change the order of the desplay. The factet grid follows alphabetical order. But i need and special order. For example the order in min 7:09 its Africa, Americas, Asia, Europe. But what if u want Europe first?
  • @Zoyfad
    thanks for the video:) btw dplyr::slice_ functions are nice diamonds %>% slice_sample(n = 5000)