[R] Kernel density estimate plot for 3-dimensional data

Duncan Murdoch murdoch.duncan at gmail.com
Tue May 4 16:46:03 CEST 2010


On 04/05/2010 10:33 AM, Pascal Martin wrote:
> Hi!
>
> I have a problem with Kernel density estimate plot for 3-dimensional data in ks-package.
> Here the example:
>
> # load ks, spatstat
> # three-dimensional kernel density of B
> B <- pp3(runif(300), runif(300), runif(300), box3(c(0,1)))
> x <- unclass(B$data)$df
> H <- Hpi(x)
> fhat <- kde(x, H=H)
> plot(fhat)
> plot(fhat, axes=FALSE, box=FALSE, drawpoints=TRUE); axes3d(c('x','y','z'))
>
> If I try to insert my own coordinates instead of the artificial 3D-pattern, it does not work.
> It would be great, if anybody could help me!

You need to be more explicit about what "does not work" means.  The 
example above works (though I don't like the axes in the first plot; I 
prefer what you get
with plot(fhat, box=FALSE)).  What problem are you having?

Duncan Murdoch



More information about the R-help mailing list