"formula"
methods do most of the actual work.cloud(x, data, ...)
wireframe(x, data, ...)## S3 method for class 'formula':
cloud(x,
data,
allow.multiple = is.null(groups) || outer,
outer = FALSE,
auto.key = FALSE,
aspect = c(1,1),
panel.aspect = 1,
panel = lattice.getOption("panel.cloud"),
prepanel = NULL,
scales = list(),
strip = TRUE,
groups = NULL,
xlab,
ylab,
zlab,
xlim = if (is.factor(x)) levels(x) else range(x, finite = TRUE),
ylim = if (is.factor(y)) levels(y) else range(y, finite = TRUE),
zlim = if (is.factor(z)) levels(z) else range(z, finite = TRUE),
at,
drape = FALSE,
pretty = FALSE,
drop.unused.levels,
...,
lattice.options = NULL,
default.scales =
list(distance = c(1, 1, 1),
arrows = TRUE,
axs = axs.default),
colorkey,
col.regions,
alpha.regions,
cuts = 70,
subset = TRUE,
axs.default = "r")
## S3 method for class 'formula':
wireframe(x,
data,
panel = lattice.getOption("panel.wireframe"),
...)## S3 method for class 'matrix':
cloud(x, data = NULL, type = "h",
zlab = deparse(substitute(x)), aspect, ...,
xlim, ylim, row.values, column.values)
## S3 method for class 'table':
cloud(x, data = NULL, groups = FALSE,
zlab = deparse(substitute(x)),
type = "h", ...)
## S3 method for class 'matrix':
wireframe(x, data = NULL,
zlab = deparse(substitute(x)), aspect, ...,
xlim, ylim, row.values, column.values)
For the "formula"
methods, a formula of the form z ~ x
* y | g1 * g2 * ...
, where z
is a numeric response, and
x
, y
are num
"formula"
methods, an optional data frame in which
variables in the formula (as well as groups
and
subset
, if any) are to be evaluated. data
should not
be specified except when usingx
is a matrix. row.values
and
column.values
must have the same lengths as nrow(x)
and ncol(x)
respectively. By default, rowxyplot
. For the cloud.table
method,
groups
must be a logical indicating whether the last
dimension should be used ascloud
(see panel.3dscatter
for details). Defaults to "h"
for the matrix
method.aspect
is taken to be a
numeric vector of length 2, giving the relative aspects of the
y-size/x-size and z-size/x-size of the enclosing cube. The usual
role of the aspect
argument ipanel.cloud
for (non-trivial) details.xyplot
for details), this list can contain
parameters in name=value form. It can also contain components with
the special ncloud
does not expand the
bounding box to slightly beyound the range of the data, even though
it should. This is primarily because this is the natural behaviour
in wireframe
, which uses xlab
and ylab
(i.e. zlab
(and <xlim
and ylim
in
other high level functionsTRUE
, the height of a facet is used to determine its color in
a manner similar to the coloring scheme used in
levelplot
levelplot
. if drape=TRUE
, at
gives the
vector of cutpoints where the colors change, and col.regions
the vector at
is unspecified, the approximate number of cutpoints if
drape=TRUE
levelplot
for details.distance
,
perspective
, screen
and R.mat
are very
important in determining taspect
). The viewing direction is given by a sequence of
rotations specified by the screen
argument, starting from the
positive Z-axis. The viewing point (camera) is located at a distance
of 1/distance
from the origin. If perspective=FALSE
,
distance
is set to 0 (i.e., the viewing point is at an infinite
distance). cloud
draws a 3-D Scatter Plot, while wireframe
draws a
3-D surface (usually evaluated on a grid). Multiple surfaces can be
drawn by wireframe
using the groups
argument (although
this is of limited use because the display is incorrect when the
surfaces intersect). Specifying groups
with cloud
results in a panel.superpose
-like effect (via
panel.3dscatter
).
wireframe
can optionally render the surface as being
illuminated by a light source (no shadows though). Details can be
found in the help page for panel.3dwire
. Note that
although arguments controlling these are actually arguments for the
panel function, they can be supplied to cloud
and
wireframe
directly.
For single panel plots, wireframe
can also plot parametrized
3-D surfaces (i.e., functions of the form f(u,v) = (x(u,v), y(u,v),
z(u,v)), where values of (u,v) lie on a rectangle. The simplest
example of this sort of surface is a sphere parametrized by latitude
and longitude. This can be achieved by calling wireframe
with a
formula x
of the form z~x*y
, where x
, y
and z
are all matrices of the same dimension, representing the
values of x(u,v), y(u,v) and z(u,v) evaluated on a discrete
rectangular grid (the actual values of (u,v) are irrelevant).
When this feature is used, the heights used to calculate drape
colors or shading colors are no longer the z
values, but the
distances of (x,y,z)
from the origin.
Note that this feature does not work with groups
,
subscripts
, subset
, etc. Conditioning variables are also
not supported in this case.
The algorithm for identifying which edges of the bounding box are
panel.cloud
tries to figure out the
optimal location of the arrows and axis labels automatically, but can
fail on occasion (especially when the view is from scpos
argument in
panel.cloud
.
These and all other high level Trellis functions have several other
arguments in common. These are extensively documented only in the
help page for xyplot
, which should be consulted to learn
more detailed usage.
Lattice
for an overview of the package, as well as
xyplot
, levelplot
,
panel.cloud
## volcano ## 87 x 61 matrix
wireframe(volcano, shade = TRUE,
aspect = c(61/87, 0.4),
light.source = c(10,0,10))
g <- expand.grid(x = 1:10, y = 5:15, gr = 1:2)
g$z <- log((g$x^g$g + g$y^2) * g$gr)
wireframe(z ~ x * y, data = g, groups = gr,
scales = list(arrows = FALSE),
drape = TRUE, colorkey = TRUE,
screen = list(z = 30, x = -60))
cloud(Sepal.Length ~ Petal.Length * Petal.Width | Species, data = iris,
screen = list(x = -90, y = 70), distance = .4, zoom = .6)
## cloud.table
cloud(prop.table(Titanic, margin = 1:3),
type = c("p", "h"), strip = strip.custom(strip.names = TRUE),
scales = list(arrows = FALSE, distance = 2), panel.aspect = 0.7,
zlab = "Proportion")[, 1]
## transparent axes
par.set <-
list(axis.line = list(col = "transparent"),
clip = list(panel = "off"))
print(cloud(Sepal.Length ~ Petal.Length * Petal.Width,
data = iris, cex = .8,
groups = Species,
main = "Stereo",
screen = list(z = 20, x = -70, y = 3),
par.settings = par.set,
scales = list(col = "black")),
split = c(1,1,2,1), more = TRUE)
print(cloud(Sepal.Length ~ Petal.Length * Petal.Width,
data = iris, cex = .8,
groups = Species,
main = "Stereo",
screen = list(z = 20, x = -70, y = 0),
par.settings = par.set,
scales = list(col = "black")),
split = c(2,1,2,1))
Run the code above in your browser using DataLab