title: Adding line of identity to correlation plots using pairs() command in R
body: <p>Similar to a <a href="https://stackoverflow.com/questions/15271103/how-to-modify-this-correlation-matrix-plot/15271627#15271627">prevous post</a>, I'd like to modify the following code (<a href="http://stat.ethz.ch/R-manual/R-devel/library/graphics/html/pairs.html" rel="nofollow noreferrer">from example in the R documentation for pairs() command</a>): </p>
  
  <pre><code>## put (absolute) correlations on the upper panels,
  ## with size proportional to the correlations.
  panel.cor &lt;- function(x, y, digits = 2, prefix = "", cex.cor, ...)
  {
      usr &lt;- par("usr"); on.exit(par(usr))
      par(usr = c(0, 1, 0, 1))
      r &lt;- abs(cor(x, y))
      txt &lt;- format(c(r, 0.123456789), digits = digits)[1]
      txt &lt;- paste0(prefix, txt)
      if(missing(cex.cor)) cex.cor &lt;- 0.8/strwidth(txt)
      text(0.5, 0.5, txt, cex = cex.cor * r)
  }
  pairs(USJudgeRatings, lower.panel = panel.smooth, upper.panel = panel.cor)
  </code></pre>
  
  <p>Instead of a loess line, I want a line of identity for each plot. The secret lies in the $"panel.smooth" function, but I don't know how to modify it. </p>