[R] [newbie] how to do a 3d plot of bivariate density?

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Thu May 21 12:44:32 CEST 2009


> I am new to R. Yesterday I passed the afternoon reading the
> introduction and language reference, but I could'nt find a way to do a
> 3d plot of the density of a data table of size 2.
> I am trying with:
> 
>  plot(density(t(t2)))
> 
> but it mixes the two columns and calculate the density like it is a
> 1-dimensional casual variable.

I presume what you mean by a data table of size 2 is something like this:

data <- matrix(c(3,53,36,17), nrow=2)

3D plots are almost never the best solution.  (You get all sorts of issues 
with perspective problems and some bits of the plot being obscured by 
other bits.)  Would something like this to the trick?

image(data)

If you want something different, then please provide an example of your 
data (nothing too big, so we can reproduce it), and a description of what 
you would like to show.

Regards,
Richie.

Mathematical Sciences Unit
HSL


------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}




More information about the R-help mailing list