Skip to content

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

2 messages · Francesco Stablum, Richard Cotton

#
Hello everybody.
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 have looked at the documentation of density, but I was not able to do it.
I have also spent quite a lot time looking in the internet for similar
issues, but found nothing helpful.

any suggestions?
thanks
-Francesco Stablum
P.S. sorry for my poor english
#
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}}