Skip to content
Back to formatted view

Raw Message

Message-ID: <49BF85EB.1030302@stats.uwo.ca>
Date: 2009-03-17T11:13:47Z
From: Duncan Murdoch
Subject: help with 3-D plot of kernel density estimates
In-Reply-To: <11417a880903170344k4e95af9cw55e00281b10350e4@mail.gmail.com>

On 17/03/2009 6:44 AM, Josh wrote:
> Hi,
> I guess I have a naive question. I use kde2d function in a standard way to
> estimate kernel densities of x and y (x and y are vectors) and plot them
> using image().
> 
> f1=kde2d(x,y)
> image(f1)
> 
> But what if I want to see kernel estimates of three variables, x, y and z (a
> vector) plotted together ? Something in which x<->y is plotted and colored
> according to the corresponding value of z ?


See the kde3d example in the misc3d package for contour plots of a 3d 
density function (not as you described, but very nicely done).

Or if you just want 3d plots of a 2d function, you can use persp (from 
graphics) or persp3d (from rgl).

Duncan Murdoch