[R] 3D Scatter Plot
Deepayan Sarkar
deepayan.sarkar at gmail.com
Sat Jun 18 04:11:15 CEST 2005
On 6/17/05, Lauren, Peter <Peter.Lauren at 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
More information about the R-help
mailing list