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

Karl Ove Hufthammer karloh at mi.uib.no
Mon May 15 10:16:18 CEST 2006


Richard M. Heiberger wrote:

> Continuing with your example.
> 
> Is this what you have in mind?

Yes, almost. Thank you so much for your elegant solution. Here's what I
ended up with:

panel.estcontplot <- function(x, y, ..., pretty=TRUE, region=FALSE)
{
  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)),
                   pretty=pretty, region=region, contour=TRUE, ...)
}

-- 
Karl Ove Hufthammer




More information about the R-help mailing list