Search code examples
ggplot2facet-grid

extract individual panels of facet plot to re-arrange


I would like to rearrange a facet plot with 3 panels to have them fit better in a poster presentation. Currently, I have A over B over C (one column), and it is important to keep B over C.

What I would like is to have a square (2x2) presentation, with A over nothing, and B over C.

Can I either extract the individual panels of the plot, or create a facet with no axes or other graphic (like plotgrid with a NULL panel).


Solution

  • A second option would be the ggh4x package which via facet_manual adds some flexibility to place the panels:

    library(ggplot2)
    library(ggh4x)
    
    design <- "
    AB
    #C"
    
    ggplot(mtcars, aes(mpg, disp)) +
      geom_point() +
      facet_manual(~cyl, design = design)