title: Adjust the font of legend in R
body: <p>I use <code>legend()</code> to produce a legend shown below</p>
  
  <p><a href="https://i.stack.imgur.com/3nUuy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3nUuy.png" alt="Legend of a plot"></a></p>
  
  <p>The text lies beyond the plot box. I tried to use <code>cex =</code> to adjust the box, however, it can only adjust the size of the whole box, but have nothing to do with the text font. </p>
  
  <p>Is there anyway to make the text font smaller?</p>
  
  <p>Here is my sample code:</p>
  
  <pre><code>legend("bottomleft", legend = c("Simulated", "Estimated/Predicted    
         Median", "95% Credit Intervals"),
         col = c("gray35", "red", "red"), lty = c(1, 1, 2), 
                 lwd = c(3, 2, 1),
         text.font = 3, inset=.02, bg='gray90')
  </code></pre>