On 18.02.2012 06:42, kpiratla wrote:
I am relatively new to R and scatterplot3d function. I need to draw a 3d scatterplot and then add three different planes (each parallel to xy, yz and zx with varying intercepts) to a 3d scatterplot. I got the plot running and i was also able to produce one plane parallel to xy surface by using the function "spd$plane3d(0.3549896,0,0,lty="dotted")". I do not understand how i can add other two planes that are parallel to yz and zx. It would be great if someone can help me with this.
The "$plane3d" function returned by scatterplot3d() is intended for planes that describe z by x and y, hence the other two planes you aim at are not directly poossible, but can easily be coded as follows:
library("scatterplot3d") spd <- scatterplot3d(1:10, 1:10, 1:10) # xy spd$plane3d(0.3549896,0,0,lty="dotted") # yz x0 <- 5 xyz1 <- spd$xyz.convert(rep(x0, 6), rep(0, 6), seq(0, 10, by=2)) xyz2 <- spd$xyz.convert(rep(x0, 6), rep(10, 6), seq(0, 10, by=2)) segments(xyz1$x, xyz1$y, xyz2$x, xyz2$y, lty="dotted") xyz1 <- spd$xyz.convert(rep(x0, 6), seq(0, 10, by=2), rep(0, 6)) xyz2 <- spd$xyz.convert(rep(x0, 6), seq(0, 10, by=2), rep(10, 6)) segments(xyz1$x, xyz1$y, xyz2$x, xyz2$y, lty="dotted") # zx y0 <- 6 xyz1 <- spd$xyz.convert(rep(0, 6), rep(y0, 6), seq(0, 10, by=2)) xyz2 <- spd$xyz.convert(rep(10, 6), rep(y0, 6), seq(0, 10, by=2)) segments(xyz1$x, xyz1$y, xyz2$x, xyz2$y, lty="dotted") xyz1 <- spd$xyz.convert(seq(0, 10, by=2), rep(y0, 6), rep(0, 6)) xyz2 <- spd$xyz.convert(seq(0, 10, by=2), rep(y0, 6), rep(10, 6)) segments(xyz1$x, xyz1$y, xyz2$x, xyz2$y, lty="dotted") Best, Uwe Ligges
Thanks Kalyan http://r.789695.n4.nabble.com/file/n4399234/Latest.pdf Latest.pdf -- View this message in context: http://r.789695.n4.nabble.com/Multiple-planes-in-a-scatterplot3d-tp4399234p4399234.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@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.
______________________________________________ R-help@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.