Creates a wireframe diagram for an object of class facDesign.c.
Usage
wirePlot(
x,
y,
z,
data = NULL,
xlim,
ylim,
zlim,
main,
xlab,
ylab,
sub,
sub.a = TRUE,
zlab,
form = "fit",
col = "Rainbow",
steps,
fun,
plot = TRUE,
show.scale = TRUE,
n.scene = "scene"
)Arguments
- x
Name providing the Factor A for the plot.
- y
Name providing the Factor B for the plot.
- z
Name giving the Response variable.
- data
Needs to be an object of class
facDesignand contains the names ofx,y,z.- xlim
Numeric vector of length 2: limits for the x-axis. If missing, limits are set automatically.
- ylim
Numeric vector of length 2: limits for the y-axis. If missing, limits are set automatically.
- zlim
Numeric vector of length 2: limits for the z-axis. If missing, limits are set automatically.
- main
Character string: title of the plot.
- xlab
Character string: label for the x-axis.
- ylab
Character string: label for the y-axis.
- sub
Character string: subtitle for the plot. Default is
NULL.- sub.a
Logical value indicating whether to display the subtitle. Default is
TRUE.- zlab
Character string: label for the z-axis.
- form
Character string specifying the form of the surface to be plotted. Options include
`quadratic``full``interaction``linear``fit`
Default is
`fit`.- col
Character string specifying the color palette to use for the plot (e.g.,
`Rainbow`,`Jet`,`Earth`,`Electric`). Default is`Rainbow`.- steps
Numeric value specifying the number of steps for the grid in the plot. Higher values result in a smoother surface.
- fun
Optional function to be applied to the data before plotting.
- plot
Logical value indicating whether to display the plot. Default is
TRUE.- show.scale
Logical value indicating whether to display the color scale on the plot. Default is
TRUE.- n.scene
Character string specifying the scene name for the plot. Default is
`scene`.
Value
The function wirePlot returns an invisible list containing:
- plot
The generated wireframe plot.
- grid
The grid data used for plotting.
Details
The wirePlot function is used to create a 3D wireframe plot that visualizes the relationship between two factors and a response variable. The plot can be customized in various ways, including changing axis labels, adding subtitles, and choosing the color palette.
Examples
# Example 1: Basic wireframe plot
x <- seq(-10, 10, length = 30)
y <- seq(-10, 10, length = 30)
z <- outer(x, y, function(a, b) sin(sqrt(a^2 + b^2)))
wirePlot(x, y, z, main = "3D Wireframe Plot", xlab = "X-Axis", ylab = "Y-Axis", zlab = "Z-Axis")
fdo = rsmDesign(k = 3, blocks = 2)
fdo$.response(data.frame(y = rnorm(fdo$nrow())))
#I - display linear fit
wirePlot(A,B,y, data = fdo, form = "linear")
#II - display full fit (i.e. effect, interactions and quadratic effects
wirePlot(A,B,y, data = fdo, form = "full")
#III - display a fit specified before
fdo$set.fits(fdo$lm(y ~ B + I(A^2)))
wirePlot(A,B,y, data = fdo, form = "fit")
#IV - display a fit given directly
wirePlot(A,B,y, data = fdo, form = "y ~ A*B + I(A^2)")
#V - display a fit using a different colorRamp
wirePlot(A,B,y, data = fdo, form = "full", col = 2)