[R] question about 3-d plot

andrew andrewjohnroyal at gmail.com
Fri Feb 27 07:26:08 CET 2009


actually, I just realised you also want a line in the plot.  I am not
super-sure how to do this.

On Feb 27, 5:20 pm, andrew <andrewjohnro... at gmail.com> wrote:
> the following should work
>
> library(lattice)
> x <- seq(1,100)
> y <- seq(1,100)
> gr <- expand.grid(x,y)
> gr$z <- x + y + rnorm(10000,0,100)
> cloud(z ~ x + y, data = gr)
>
> also, look for the package rgl which does similar but with more
> possiblities.
>
> On Feb 27, 4:28 pm, Dipankar Basu <basu... at gmail.com> wrote:
>
>
>
> > Hi R Users,
>
> > I have produced a simulated scatter plot of y versus x tightly clustered
> > around the 45 degree line through the origin with the following code:
>
> >  x <- seq(1,100)
> >  y <- x+rnorm(100,0,10)
> >  plot(x,y,col="blue")
> >  abline(0,1)
>
> > Is there some way to generate a 3-dimensional analogue of this? Can I get a
> > similar simulated scatter plot of points in 3 dimensions where the points
> > are clustered around a plane through the origin where the plane in question
> > is the 3-dimensional analogue of the 45 degree line through the origin?
>
> > Deepankar
>
> >         [[alternative HTML version deleted]]
>
> > ______________________________________________
> > R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list