Michael Hopkins skreiv:
> The kernel density plots don¹t have to be very sophisticated i.e.
> default settings and greyscale are fine we can work on details
> later. What has stumped us so far is how you ‘attach’ the kernel
> density results to the scatterplot results and then overlay them.
>
> Any ideas, links or code gratefully received.
Here’s my suggestion¹:
library(lattice)
library(MASS)
splom(~iris[1:4], panel=function(x,y)
{
xy=kde2d(x,y)
xy.tr=con2tr(xy)
panel.contourplot(xy.tr$x, xy.tr$y, xy.tr$z,
subscripts=seq(nrow(xy.tr)),
contour=TRUE, region=FALSE)
panel.xyplot(x,y)
}
)
¹ Which is basically Richard M. Heiberger’s solution to a similar
query I had on this list earlier about a month ago:
http://tolstoy.newcastle.edu.au/R/help/06/05/27184.html
--
Karl Ove Hufthammer
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html