Selectively tweaking pairs() axes? Question on pairs()
I'd like to use pairs() to choose a functional form for modeling a set of data.  I know that several of my independent and dependent variables are probably lognormally distributed, so I'd like to produce pairs() plots where some of my variables are plotted on log axes and some are not.
It seems like the par() command might hold the key, but I don't know how to implement it.  


*

*Can I specify log/linear axes behavior when I call pairs()?  

*Do I plot pairs() first and then modify the resulting graph using par()?  Am I on the wrong track entirely?


I'm sure I could accomplish the task more easily by transforming some of my variables to log space, but I'm trying to learn something along the way here.
 A: With pairs, you can set the upper, lower and diagonal panels to display differently by passing functions which setup the layout of the plot (so, use text() or points() or lines() rather than plot() which makes a new plot). 
So something like this:
set.seed(123)
#fake some data
exp1 <- rnorm(1000,5,1)
exp2 <- rlnorm(1000,0.5,1)
response <- exp1+exp2+rnorm(1000)

panel.loglog <- function(x,y, ...){
   #"usr" is a par attribute that sets the plot area
   par(usr = c(0, max(log(x)+3), 0, max(log(y)+3) ))
   points(log(x), log(y))
}

pairs(response~exp1+exp2, panel.lower=panel.loglog)

But it seems you're more interested in the distribution of your variables than the relationship? In that case you could add histograms to the diagnoal (the panel.hist function is from the help for pairs)
panel.hist < function(x, ...){
    usr <- par("usr"); on.exit(par(usr))
    par(usr = c(usr[1:2], 0, 1.5) )
    h <- hist(x, plot = FALSE)
    breaks <- h$breaks; nB <- length(breaks)
    y <- h$counts; y <- y/max(y)
    rect(breaks[-nB], 0, breaks[-1], y, col="cyan", ...)
}

pairs(response~exp1+exp2, lower.panel=panel.loglog, diag.panel=panel.hist)

Which will give you this:

