Description Usage Arguments Details Author(s) See Also Examples
Method for plotting data in three dimensions.
1 2 3 4 5 6 | ## Default S3 method:
plot3d(x=seq(0, 1, len = length(z)), y=seq(0, 1, len = length(z)), z,
xlim=range(x, na.rm = TRUE), ylim=range(y, na.rm = TRUE), zlim=range(z, na.rm = TRUE),
xlab=NULL, ylab=NULL, zlab=NULL, main=NULL, sub=NULL, col=par("col"), theta=0, phi=15,
r=sqrt(3), d=1, scale=TRUE, expand=1, border=NULL, box=TRUE, axes=TRUE, nticks=5,
ticktype="simple", depthOrder=TRUE, ...)
|
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
|
z |
the z coordinates of points in the plot, optional if
|
xlim, ylim, zlim |
the ranges to be encompassed by the x, y and z axes. The plot is produced so that the rectangular volume defined by these limits is visible. |
xlab, ylab, zlab |
the title for the x, y and z axis. These must the character strings; expressions are not accepted. |
main |
an overall title for the plot. |
sub |
the subtitle for the plot. |
col |
the color of the data points. |
theta, phi |
angles defining the viewing direction. theta gives
the azimuthal direction and phi the colatitude. Default values are
|
r |
the distance of the eyepoint from the centre of the plotting
box. Default value is |
d |
a value which can be used to vary the strength of the
perspective transformation. Values of d greater than 1 will
lessen the perspective effect and values less and 1 will exaggerate
it. Default value is |
scale |
before viewing the x, y and z coordinates of the points
defining the surface are transformed to the interval [0,1]. If scale
is |
expand |
a expansion factor applied to the z coordinates. Often
used with 0 < |
border |
the color of the line drawn around the surface facets.
A value of |
box |
should the bounding box for the surface be displayed.
Default value is |
axes |
should ticks and labels be added to the box.
If |
ticktype |
If |
nticks |
the (approximate) number of tick marks to draw on the
axes. Has no effect if ticktype is |
depthOrder |
If |
... |
Comma-separated list of things to be displayed. |
Internally plot3d
() is based on the persp
function, which in fact returns a transformation matrix
.
Henrik Bengtsson
For adding lines to a 3D plot see lines3d
().
For adding points to a 3D plot see points3d
().
For adding text labels 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
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Simulate some (x,y,z) data
n <- 20000
x <- runif(n, 0, 2*pi)
y <- runif(n, 0, 2*pi)
z <- sin(x) * cos(y)
zeroone <- function(x) {
x.r <- range(x, na.rm=TRUE)
(x - x.r[1])/(x.r[2]-x.r[1])
}
h <- zeroone(z)
s <- zeroone(x)
v <- zeroone(y)
col <- hsv(h=h, s=1, v=1)
plot3d(x,y,z, phi=30, theta=30, pch=".", col=col)
omega <- seq(0, 6*pi, length.out=500)
x <- sin(omega); y <- cos(omega)
plot3d(x,y,omega, pch=176, col=hsv(omega/max(omega), 1,1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.