Last chance! 50% off unlimited learning
Sale ends in
planes3d(a, b = NULL, c = NULL, d = 0, ...)
rgl.planes(a, b = NULL, c = NULL, d = 0, ...)
xyz.coords
for details.rgl.material
for details.a, b, c, d
; the other
values will be recycled as necessary.abclines3d
, rgl.abclines
for mathematical lines.triangles3d
, rgl.triangles
or the corresponding
functions for quadrilaterals may be used to draw sections of planes that
do not adapt to the bounding box.
# Show regression plane with z as dependent variable
x <- rnorm(100)
y <- rnorm(100)
z <- 0.2*x - 0.3*y + rnorm(100, sd=0.3)
fit <- lm(z ~ x + y)
plot3d(x,y,z, type="s", col="red", size=1)
coefs <- coef(fit)
a <- coefs["x"]
b <- coefs["y"]
c <- -1
d <- coefs["(Intercept)"]
planes3d(a, b, c, d, alpha=0.5)
Run the code above in your browser using DataLab