title: Automatically scale font size (etc.) of ggplot2 inside an Rmarkdown document
body: <p>I have some <code>ggplot2</code> plots with <em>lots</em> of text in them (no way around that), that I am building inside an <code>*.Rmd</code>, like so:</p>
  
  <pre><code>---
  title: "SO Test"
  output: pdf_document
  ---
  
  ```{r}
  library(ggplot2)
  df &lt;- data.frame(rep(1:5,5),rep(1:5, each=5),rep("Test",5))
  colnames(df) &lt;- c("x", "y", "word")
  ggplot(data = df, mapping = aes(x = x, y = y, label = word)) +      geom_text()
  ```
  </code></pre>
  
  <p>That works great, giving me something like the below as a PDF.</p>
  
  <p><img src="https://i.stack.imgur.com/EUySj.jpg" alt="enter image description here"></p>
  
  <p>I would now like to make these labels (<code>Test</code>) as large as possible without overplotting.</p>
  
  <p>My problem is that I now see <strong>2</strong> "levers" which I could pull to change the font size:</p>
  
  <ol>
  <li>"inside" <code>ggplot2</code>, change, add, say, <code>geom_text(size=12)</code></li>
  <li>upon plotting, "inside" <code>knitr</code> (or <code>Rmarkdown</code>?), add a chunk option like `fig.width=15, fig.height=15), which <em>also</em> changes the font size <em>relative</em> to the overall plot size (for reasons I don't really understand).</li>
  </ol>
  
  <p>Obviously, <strong>1.</strong> would be the straightforward way, but I then need to adjust <code>geom_text(size=...)</code> always depending on the size of the output, say, when the <code>linewidth</code> in LaTeX changes or the column width of my blog post.
  That seems inelegant, to say the least.</p>
  
  <p>How do I go about this in an elegant, scalable way that produces a pretty plot?</p>
  
  <p>I'm still a bit fuzzy about this, and where in the toolchain (<code>Rmarkdown</code>?, <code>Knitr</code>?, <code>GGplot2</code>) I should start ...</p>
  
  <p>Ps.: as a bonus, the font size should be arrived at programmatically, because the length of string <code>Text</code> varies from plot to plot in real life.</p>