rgl
package to draw 3D scatterplots
with various regression surfaces.scatter3d(x, y, z, xlab=deparse(substitute(x)), ylab=deparse(substitute(y)),
zlab=deparse(substitute(z)), revolutions=0,
bg.col=c("black", "white"), axis.col=NULL,
surface.col=c("blue", "green", "orange", "magenta", "cyan", "red",
"yellow", "gray"),
neg.res.col="red", pos.res.col="green", point.col="yellow",
text.col=axis.col, grid.col=if (bg.col == "white") "black" else "gray",
fogtype=c("exp2", "linear", "exp", "none"),
residuals=(length(fit) == 1), surface=TRUE, grid=TRUE, grid.lines=26,
df.smooth=NULL, df.additive=NULL,
sphere.size=1, threshold=0.01, speed=1, fov=60,
fit="linear", groups=NULL, parallel=TRUE, model.summary=FALSE)
"white"
, "black"
."white"
for black background,
"black"
for white background.fit
."exp2"
, "linear"
,
"exp"
, "none".
TRUE
or FALSE
); available only
when there is one surface plotted.TRUE
or FALSE
).TRUE
or FALSE
).NULL
(the default), the gam
function will select the degrees of freedom
for a smoothing spline by generalized NULL
(the default), the gam
function will select degrees of freedom
for the smoothing splines by generalized cross-validation; if a positiv"linear"
, "quadratic"
, "smooth"
,
"additive"
; to display fitted surface(s); partial matching is supported --
e.g., c("lin", "quad")
.NULL
(the default), no groups are defined; if a factor, a different surface
or set of surfaces is plotted for each level of the factor; in this event, the colours in
plane.col
are used successively for the points, sgroups
, should the surfaces be constrained to be
parallel? A logical value, with default TRUE
.TRUE
or FALSE
).rgl.open
, gam
data(state)
State.x77 <- as.data.frame(state.x77)
with(State.x77, scatter3d(Income, Murder, Illiteracy))
with(State.x77, scatter3d(Income, Murder, Illiteracy, fit=c("linear", "quadratic")))
Run the code above in your browser using DataLab