Last data update: 2014.03.03

R: Visualize raw surface averages (3d)
plotRaw3d.fncR Documentation

Visualize raw surface averages (3d)

Description

For a specified response variable and interacting continuous predictors, visualize in 3d the surface average.

Usage

plotRaw3d.fnc(data = NULL, response = NULL, pred = NULL, intr = NULL, 
xy = TRUE, color = "topo", zlim = NULL, xlab = NULL, ylab = NULL, 
zlab = NULL, main = NULL, shift = 0, scale = 1, plot.type = "contour", 
add = FALSE, alpha = 1, theta = 30, phi = 30, ticktype = "detailed", 
contourstepsize = 1, legend.args = NULL, ...)

Arguments

data

A data frame.

response

The quoted name of a continuous response variable.

pred

The quoted name of a continuous predictor.

intr

The quoted name of an interacting continuous predictor.

xy

Whether to the x and y values from the data or to set them to seq(0, 1, len = nrow(z)). Defaults to TRUE.

color

The colour scheme to use. One of "topo", "heat", "cm", "terrain", "gray" or "bw".

zlim

A two element vector specifying the plotting limits for the z-axis.

xlab, ylab, zlab

Titles for the axes. N.B. These must be character strings; expressions are not accepted. Numbers will be coerced to character strings.

main

The main title on top of the plot.

shift

Constant to add to the smooth (on the scale of the linear predictor) before plotting. Defaults to 0.

scale

Constant by which to multiply the smooth before plotting. Defaults to 1.

plot.type

The type of plot to make. Can be any of "contour", "persp", the default, or, if package rgl is available, "persp3d".

add

Whether to add the points to an existing plot. This capability is only implemented for plot.type = "persp3d".

alpha

Alpha values between 0.0 (fully transparent) to 1.0 (opaque).

theta

Angle defining the viewing direction. theta gives the azimuthal direction.

phi

Angle defining the viewing direction. phi gives the colatitude.

ticktype

Character: "simple" draws just an arrow parallel to the axis to indicate direction of increase; "detailed" draws normal ticks as per 2D plots.

contourstepsize

The size of the steps from contour line to contour line. Defaults to 1. Used only if plot.type = "contour".

legend.args

When plot.type = "image.plot", arguments for a complete specification of the legend label. This is in the form of list and is just passed to the mtext function. (See example in image.plot help page). Defaults to NULL.

...

Further arguments passed to functions image, image.plot, contour, persp, or persp3d.

Details

NAs will be set to 0. You can set add = TRUE and e.g., alpha = 0.7 to add the raw data plot to an estimated two-way interactions between continuous fixed effects. To save screenshots of "persp3d" plots (after plotting), use function rgl.snapshot (produces png files) or function rgl.postscript (produces eps files).

Value

Either a dynamic 3d perspective plot, a perspective plot, or a contour plot. Also invisibly returns the plotting matrix and the color vector.

Author(s)

Antoine Tremblay, Dalhousie University trea26@gmail.com

Examples

# see example in LMERConvenienceFunctions help page.

Results