[R] Contour plot (level curves)
hadley wickham
h.wickham at gmail.com
Thu Oct 4 18:28:17 CEST 2007
On 10/4/07, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> On Thu, 4 Oct 2007, Caio Azevedo wrote:
>
> > Hi all,
> >
> > I have a sample of n values from a bivariate distribution (from a MCMC
> > procedure). How could I draw a contour plot of "the joint density" based on
> > that sample ?
>
> You need to estimate the density, and contour that estimate. MASS has
> examples using its kde2d function. There are other methods available,
> e.g. in package sm.
If you want something ready made, ggplot2 uses kde2d to draw contours
from a kernel density estimate -
http://had.co.nz/ggplot2/stat_density_2d.html
Hadley
--
http://had.co.nz/
More information about the R-help
mailing list