[R] Adding plane in a 3D scatterplot

Uwe Ligges ligges at statistik.tu-dortmund.de
Thu Oct 2 20:08:54 CEST 2008



Megh Dal wrote:
> I have drawn a 3D scatter plot :
> 
> library(mnormt)
> library(scatterplot3d)
> dat = cbind(rmnorm(3, rep(0,2), diag(2)), 1:3)
> scatterplot3d(dat)
> 
> Now I want to do 2 things :
> 
> 1 : In the Z-axis (i.e. height), I want to see only numbers 1,2,3, etc NOT, 1,1.5,2,2.5.............
> 
> 2. I want to add two Horizontal planes at hight z=2 and z=3. Those two planes should look like "bottom" of that 3D plot [i.e. like Grid-lines].I already gone through "$plane3d" but could not get through. In the help page, a description is given with a regression line, however I could not understand how I can implement that in my problem. 

Example:

  s3d <- scatterplot3d(dat, lab.z=2, scale.y=0.7, angle=20)
  s3d$plane3d(2,0,0, "solid", col="grey")

Uwe Ligges


> Any help will be highly appreciate. 
> 
> Regards,
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list