[R] ellipse in pairs plot

Kaveh Vakili kaveh.vakili at ulb.ac.be
Fri Nov 14 02:01:00 CET 2008


Hi dear list,

I'm scrambling with this:

i have a p-dimensional data frame for which i want to have a pairs() plot, with ellipse added in each lower.panel.

I want the ellipse's parameter (mu, sigma) to be extracted from the appropriate entries in a pre-computed matrix ("dab" in the code below).

Can it be done ?

Thanks in advance, 


melly<-function (x, y, col = par("col"), bg = NA, pch = par("pch"),cex = 1){
    points(x, y, pch = pch, col = col, bg = bg, cex = cex)
    ok <- is.finite(x) & is.finite(y)
    if (any(ok)) 
        ellipse(mu=dab$center[?],sigma=dab$cov[?,?])
}

pairs(wf[,1:5],diag.panel=bagwag,col=wc,pch=wp,cex=.5,lower.panel=melly)



More information about the R-help mailing list