Skip to content

combining pairs plot with other plots in one output

2 messages · Ulrich, David Winsemius

#
On Oct 27, 2011, at 6:27 PM, Ulrich wrote:

            
Right. But you have not specified what should go in what location.
You should look at the ?pairs page. It implements a panel.hist  
function that can be offered to diag.panel:

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(data, diag.panel=panel.hist, upper.panel=panel.smooth)


There is also a panel.pairs function in package lattice, but you would  
need to create your page layout with grid calls rather than base  
graphics.