spinplot {msir} | R Documentation |
Rotating three-dimensional plot
Description
General function to draw a rgl-based rotating 3D scatterplot.
Usage
spinplot(x, y, z,
scaling = c("abc", "aaa"),
rem.lin.trend = FALSE,
uncor.vars = FALSE,
fit.ols = FALSE,
fit.smooth = FALSE,
span = 0.75,
ngrid = 25,
markby,
pch.points = 1,
col.points = "black",
cex.points = 1,
col.axis = "gray50",
col.smooth = "limegreen",
col.ols = "lightsteelblue",
background = "white",
...)
Arguments
x |
a vector of values for the variable in the horizontal (H) screen axis. |
y |
a vector of values for the variable in the vertical (V) screen axis. |
z |
a vector of values for the variable in the out-of-screen (O) axis. |
scaling |
the scaling applied. Two possible values are |
rem.lin.trend |
a logical specifying if the linear trend should be remove. If |
uncor.vars |
a logical specifying if uncorrelated H and O variables should be used. If |
fit.ols |
a logical specifying if a fitted OLS plane should be included. |
fit.smooth |
a logical specifying if a nonparametric smoothing plane should be included. |
span |
the span used by |
ngrid |
the number of grid points to use for displaing the fitted plane. |
markby |
a variable (usually a factor) to be used for marking the points. |
pch.points |
a vector of symbols for marking the points. |
col.points |
a vector of colors for marking the points. |
cex.points |
the cex for points. |
col.axis |
the color of the axis. |
col.ols |
the color to be used for drawing the OLS plane. |
col.smooth |
the color to be used for drawing the smoothing plane. |
background |
the color of background space. |
... |
catch further unused arguments. |
Details
This function is mainly based on the functionality of the spin-plot
function once available in XLisp-Stat software https://en.wikipedia.org/wiki/XLispStat, and the adds-on introduced by the Arc software http://www.stat.umn.edu/arc/index.html.
Author(s)
Luca Scrucca luca.scrucca@unipg.it
References
Cook R. D., Weisberg S. (1999) Applied Regression Including Computing and Graphics, Wiley, Chapter 8
Examples
## Not run:
x1 <- rnorm(100)
x2 <- rnorm(100)
y <- 2*x1 + x2^2 + 0.5*rnorm(100)
spinplot(x1, y, x2)
spinplot(x1, y, x2, scaling = "aaa")
spinplot(x1, y, x2, rem.lin.trend = "TRUE")
spinplot(x1, y, x2, fit.smooth = TRUE)
spinplot(x1, y, x2, fit.ols = TRUE)
x <- iris[,1:3]
y <- iris[,5]
spinplot(x)
spinplot(x, markby = y)
spinplot(x, markby = y, col.points = c("dodgerblue2", "orange", "green3"))
spinplot(x, markby = y, pch = c(0,3,1), col.points = c("dodgerblue2", "orange", "green3"))
# to save plots use
# rgl.postscript("plot.pdf", fmt="pdf")
# or
# rgl.snapshot("plot.png")
## End(Not run)