title: Plot margins in RMarkdown/knitr
body: <p>Within RStudio my plots look perfect, but when I generate HTML via the "knit HTML" button my margins are being cut off.</p>
  
  <p>I am using the base graphics package to create a simple barplot.</p>
  
  <p>I have a large lower margin to accommodate vertical labels across the x-axis, and a wide left margin to keep the y-axis title to the left of some large numbers, e.g.:</p>
  
  <pre><code>```{r set-graph-options}
  par(mar = c(12, 6, 4, 2) + 0.1, mgp = c(4, 1, 0), las = 2)
  ```
  </code></pre>
  
  <p>Both the x-axis and y-axis labels/titles are affected; with the default <code>mgp</code> setting my <code>ylab</code> setting appears fine, but with a larger value it seems to be pushed off the "canvas" (or whatever the terminology is in R).</p>
  
  <p>I also notice that knitr/rmarkdown does not recognize the globally set <code>par()</code> options.  For example, after setting the above, <code>barplot(injury_top12, ylab = "Injuries")</code> will recognize none of the <code>mar</code>, <code>mgp</code>, or <code>las</code> options, but if I copy the options into the <code>barplot()</code> call itself, <code>las = 2</code> &amp; <code>mgp = c(4, 1, 0)</code> begin to work, but <code>mar</code> is still not recognized.</p>
  
  <p>I have tried generating the HTML from the command line with the command <code>R -e "rmarkdown::render('Readme.Rmd')"</code>, which exhibited the same problem.</p>
  
  <p>I am using R Studio 0.98.1103, knitr is 1.11, rmarkdown is 0.8, OS is ubuntu linux.</p>
  
  <p>Example.Rmd:</p>
  
  <pre><code>```{r echo = F, example-set-par}
  library(knitr)
  opts_knit$set(cache = FALSE, verbose = TRUE, global.par = TRUE)
  par(mar = c(12, 6, 4, 2) + 0.1, mgp = c(4, 1, 0), las = 2)
  d &lt;- c("This is a longer than usual label" = 355,
         "Another quite long label" = 144,
         "A third longish label for a barplot" = 222)
  ```
  
  Plot one depends on values set by `par()`:
  
  ```{r echo = F, example-plot-using-par}
  barplot(d, ylab = "Arbitrary numbers")
  ```
  
  Plot two explicitly sets options:
  
  ```{r echo = F, example-plot-with-explicit-options}
  barplot(d, ylab = "Arbitrary numbers", mar = c(12, 6, 4, 2) + 0.1, mgp = c(4, 1, 0), las = 2)
  ```
  </code></pre>
  
  <p>When I knit this Rmd doc, the first plot does not use the <code>las</code> or <code>mgp</code> options set in <code>par()</code>.  The second plot does, but the x-axis labels are cut off, and the y-axis title is pushed almost entirely out of the frame (the tail of the y is slightly visible).</p>
  
  <p><img src="https://i.imgur.com/vUqrR5Z.png" alt="example image"></p>