title: How to incorporate varying title and variable values in plot labels in loop
body: <p>I am trying to create numerous plots with varying parameter values.  When I submit the code below:</p>
  
  <hr>
  
  <pre><code>for(i in mars){
      for(j in 1:5){
          negRets &lt;- -table1.matrix[,j]
          tauSigma &lt;- gpd(negRets,threshold=i)
          tau &lt;- tauSigma$par.ests[1]
          sigma &lt;- tauSigma$par.ests[2]
          #cat("For ", reitPort[j], "portfolio and MAR=", i, "the parameter estimats are:", "\n")
          #cat("Tau= ", tau, "Sigma= ", sigma, "\n")
          exceedence.vector &lt;- sort(subset(negRets, negRets &gt; i))
          returns.sorted &lt;- sort(negRets)
          pdf(paste("C:\\Users\\John Broussard\\Dropbox\\evtHandbookProject\\figuresTables\\mar_",i,"_",reitPort[j],".pdf",sep=""))
              plot(returns.sorted, dgpd(returns.sorted, xi = tau, beta = sigma), type ="l", col="blue", ylim=c(0,90))
              title(main=cat("Tau= ", tau, " Sigma= ", sigma), ylab=" ")
          dev.off()
          #print(j)
          #print(i)
      }
  }
  </code></pre>
  
  <hr>
  
  <p>The plots are written to the files, but no title, and the y-axis label contains "xi=tau," not the value for xi submited in the plot code.  </p>
  
  <p>How do I get a title and the values of the parameters being using for the plots to be incorporated into the individual files?</p>