Re: [R] 3D Scatter Plot

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Sat 18 Jun 2005 - 12:11:15 EST

On 6/17/05, Lauren, Peter <Peter.Lauren@essexcorp.com> wrote:
> Hello:
>
>
>
> I would like to be able to do a 3D scatter plot from 3 variables, 2
> independent and 1 dependent. The closest R function I could find for
> this is "cloud". However cloud uses, as input, a matrix where the value
> of each matrix element is the dependent variable value at that matrix
> coordinate.

What makes you think that?

> My problem is that the independent variable values are
> floating point and can be of any value. Consequently some of the matrix
> bins may not have a value assigned. An example of the sort of data I
> may have is as follows
>
>
>
> Independent 1 Independent 2 Dependent
>
> 0.145674 0.526482534 1.676986
>
> 0.325634 0.326385237 2.384384
>
> 0.235267 0.352653288 0.356483
>
>
>
> Is there any way to do a 3D scatter plot with this sort of data?

The following should work fine:

df <-

    data.frame(x = c(0.145674, 0.325634, 0.235267),
               y = c(0.526482534, 0.326385237, 0.352653288),
               z = c(1.676986, 2.384384, 0.356483))

cloud(z ~ x * y, df)

Deepayan



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jun 18 12:14:11 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:50 EST