stem3d: Adds stems to a 3d plot

Description Usage Arguments Author(s) See Also Examples

Description

Adds stems to a three dimensional plot previously created by plot3d() or persp(). Three-dimensional stem plots display lines extending from the xy-plane (by default). A plot symbol represents the z value at the end of each stem.

Usage

1
2
3
4
## Default S3 method:
stem3d(x=seq(0, 1, len = nrow(z)), y=seq(0, 1, len = ncol(z)), z,
  persp.matrix=getOption("persp.matrix"), plane=c("xy", "xz", "yz", "yx", "zx", "zy"),
  cex=par("cex"), col=par("col"), pch=par("pch"), depthOrder=TRUE, ...)

Arguments

x

the coordinates of points in the plot. Alternatively, a single plotting structure, function or any R object with a plot method can be provided.

y

the y coordinates of points in the plot, optional if x is an appropriate structure.

z

the z coordinates of points in the plot, optional if x is an appropriate structure.

persp.matrix

an 4-by-4 transformation matrix describing how to project the (x,y,z) points to the drawing canvas as the one returned by persp()

. Default value is getOption("persp.matrix"), which is set by plot3d().

plane

Plane from which the stems are originating. Possible planes are xy, xz and yz. If the letters are reversed, e.g. yx, the stem will originate from the oposite side of the 3d cube.

cex

the character expansion of the data points. Default is par("cex").

col

the color of the data points. Default value is par("col").

pch

plotting "character", i.e. symbol to use. For more information see points. Default value is par("pch").

depthOrder

If TRUE, the data points are plotted back-to-from relative to the view plane, otherwise they are plotted in the order they occur in the data.

...

further arguments accepted by points.

Author(s)

Henrik Bengtsson

See Also

For creating a 3D plot see plot3d(). For adding lines to a 3D plot see lines3d(). For adding points to a 3D plot see points3d(). For adding text to a 3D plot see text3d(). For adding polygons to a 3D plot see polygon3d(). For adding stems to a 3D plot see stem3d(). See also persp. Package scatterplot3d by Uwe Ligges. For detail about the graphical parameter arguments, see par.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
x <- seq(0,2, length.out=20)
y <- x / 2
z <- sin(x) + cos(y)

layout(matrix(1:4, nrow=2, byrow=TRUE))

plot3d(x,y,z, type="n", theta=-25, phi=30) # empty 3d plot
stem3d(x,y,z, col="blue", pch=1, cex=1.5)

plot3d(x,y,z, type="n", theta=-25, phi=30) # empty 3d plot
stem3d(x,y,z, col="red", pch=1, cex=1.5, plane="xz")

plot3d(x,y,z, type="n", theta=-25, phi=30) # empty 3d plot
stem3d(x,y,z, col="green", pch=1, cex=1.5, plane="yz")

plot3d(x,y,z, type="n", theta=-25, phi=30) # empty 3d plot
stem3d(x,y,z, col="cyan", pch=".", cex=1.5, plane="xy")
stem3d(x,y,z, col="orange", pch=".", cex=1.5, plane="zx")

HenrikBengtsson/R.basic documentation built on May 6, 2019, 11:51 p.m.