[R] Conditional contour plots for estimated density functions using Lattice

Richard M. Heiberger rmh at temple.edu
Fri May 12 16:46:17 CEST 2006


Continuing with your example.

Is this what you have in mind?

Rich


panel.estcontplot <- function(x, y, ..., col.points="black") {
  cest.gr=kde2d(x, y)
  cest.gr.lat=con2tr(cest.gr)
  panel.contourplot(cest.gr.lat$x, cest.gr.lat$y, cest.gr.lat$z,
                    subscripts=seq(nrow(cest.gr.lat)), ...)
  panel.xyplot(x, y, ..., col=col.points)
}

xyplot(y ~ x | grp, panel=panel.estcontplot)




More information about the R-help mailing list