R markdown. White Space between plots. pdf document

Does anyone know how to add 1-2 extra lines of whitespace between plots in markdown? I have 2 different examples. First one is using patchwork(). The second is using mfrow=c(1,2).

I'm happy to try a different package or something. Thanks for the help.

FYI, I'm knitting it to a .pdf.

---
title: "patchwork"
author: "name"
date: "3/3/2020"
output:
  pdf_document: default
  html_document:
    df_print: paged
  'pdf_document: default': default
classoption: landscape
---

```{r setup, include=FALSE, message=FALSE, warning=FALSE}
knitr::opts_chunk$set(echo = TRUE,fig.width=11, fig.height=7)

library(ggplot2)
library(patchwork)

p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp))
p2 <- ggplot(mtcars) + geom_boxplot(aes(gear, disp, group = gear))

Trying to get more white space between plots.


p1/p2 + plot_layout(ncol = 1)


mfrow=c(1,2)
p1
p2

Adjust the ggplot objects panel.margins in theme()

Thanks. That worked.
plot.margin=margin(t,r,b,l,"cm")

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.