title: How to make multiple plots fill the entire page in Rmarkdown with pdf output
body: <p>I am trying to have multiple histogram plots rendered from a for loop fill up the entire page on my R Markdown pdf output.</p>
  <p>My histogram plots are rendered from the following code</p>
  <pre><code>mclogins&lt;-c(&quot;sacfreq&quot;,&quot;logsacfreq&quot;,&quot;meanvel&quot;,&quot;logmeanvel&quot;, &quot;meanvelx&quot;,&quot;logmeanvelx&quot;, &quot;meanvely&quot;,&quot;logmeanvely&quot;,&quot;meanacc&quot;,&quot;logmeanacc&quot;, &quot;meanaccx&quot;, &quot;logmeanaccx&quot;, &quot;meanaccy&quot;,&quot;logmeanaccy&quot;, &quot;meanamp&quot;, &quot;logmeanamp&quot;, &quot;meanampx&quot;,&quot;logmeanampx&quot;, &quot;meanampy&quot;,&quot;logmeanampy&quot;)
  
  # dev.off()
  par(mar=c(5.1 ,4.1, 4.1 ,2.1),mfrow=c(3,2))
  
  for( i in mclogins){
    hist(df.1log[,i],
         xlab = i,
         main = paste(&quot;Histogram of&quot;,i),
         col = &quot;lightblue&quot;)
  }
  
  </code></pre>
  <p>Where <code>df.1log</code> is the dataset containing values for all variables in <code>mclogins</code></p>
  <p>Right now, my output looks like this:
  <a href="https://i.stack.imgur.com/FaztT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FaztT.png" alt="enter image description here" /></a></p>
  <p>And as you can see, there is much empty space at the bottom of the page.</p>
  <p>I have tried the following suggestions:</p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/33344475/rplot-fitting-multiple-plots-properly-on-one-a4-pdf-page">R:plot : fitting multiple plots properly on one A4 pdf page</a></li>
  <li><a href="https://stackoverflow.com/questions/40603079/r-pdf-set-margin">R pdf set margin</a></li>
  </ul>
  <p>But it ends up causing the plots to disappear or nothing changes and the blank space is still there.</p>
  <p>Thank you so much!</p>