[R] 3D density plot of point set
Duncan Murdoch
murdoch.duncan at gmail.com
Wed Jul 13 18:06:46 CEST 2011
On 13/07/2011 3:56 AM, Lutz Gehlen wrote:
> Hello everybody,
> I would like to solve the problem described below in R (if
> possible). I am very new to R and have therefore no idea what to
> even look for in the docu. Therefore, if someone could tell me if
> this is possible in R and where I might find the respective docu
> then I would already be very thankful.
>
> I have a large set (a few million) of points in 3D. I would like to
> create a contour density plot that would show a surface of constant
> density which includes e.g. 50% of the points. Ideally, the surface
> would be semitransparent, such that I can show two or three at the
> same time.
>
> Alternatively, if I would calculate the contour surfaces myself,
> could I use R to semitransparently visualize a triangulated surface?
For the latter, see the misc3d package, in particular the contour3d
function. Use the rgl engine with alpha=0.5 (or some other value) for
semi-transparency.
For computing the density estimates there are lots of choices, including
the kde3d function that's also in the misc3d package.
To find the contour holding 50% of the points, compute the density at
all of them, and find the median density.
Duncan Murdoch
More information about the R-help
mailing list