Question: I use `legend()` to produce a legend shown below

[![Legend of a plot](https://i.stack.imgur.com/3nUuy.png)](https://i.stack.imgur.com/3nUuy.png)

The text lies beyond the plot box. I tried to use `cex =` to adjust the box, however, it can only adjust the size of the whole box, but have nothing to do with the text font. 

Is there anyway to make the text font smaller?

Here is my sample 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')

```

Answer: 
You can set graphical parameters by applying `par()`. For example: 

```
plot(c(1:4), c(1:4), type  = 'l')    
par(cex = 1) #set legend font to 1
legend("topleft", legend="a line", lty = 1)

```
If you set `bty="n"` it won't draw a box

```
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',bty="n")

```