File: plot3d.Rd

package info (click to toggle)
rgl 1.3.34-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,968 kB
  • sloc: cpp: 23,234; ansic: 7,462; javascript: 6,125; sh: 3,555; makefile: 2
file content (105 lines) | stat: -rw-r--r-- 4,125 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
\name{plot3d}
\alias{plot3d}
\alias{plot3d.default}
\alias{plot3d.mesh3d}
\title{3D scatterplot}
\description{
Draws a 3D scatterplot.
}
\usage{
plot3d(x, ...)
\method{plot3d}{default}(x, y, z,  
	xlab, ylab, zlab, type = "p", 
	col, size, lwd, radius,
	add = FALSE, aspect = !add, 
	xlim = NULL, ylim = NULL, zlim = NULL, 
	forceClipregion = FALSE, 
	decorate = !add, ...)
\method{plot3d}{mesh3d}(x, xlab = "x", ylab = "y", zlab = "z", type = c("shade", "wire", "dots"),
	add = FALSE, aspect = !add, ...)	
}
\arguments{
  \item{x, y, z}{vectors of points to be plotted. Any reasonable way of defining the
    coordinates is acceptable.  See the function \code{\link[grDevices]{xyz.coords}}
    for details.}
  \item{xlab, ylab, zlab}{labels for the coordinates.}
  \item{type}{For the default method, a single character indicating the type of item to plot.  
  Supported types are: 'p' for points, 's' for spheres, 
  'l' for lines, 'h' for line segments 
  from \code{z = 0}, and 'n' for nothing.  For the \code{mesh3d} method, one of 
  'shade', 'wire', or 'dots'.  Partial matching is used.
  }
  \item{col}{the color to be used for plotted items.}
  \item{size}{the size for plotted points.}
  \item{lwd}{the line width for plotted items.}
  \item{radius}{the radius of spheres:  see Details below.}
  \item{add}{whether to add the points to an existing plot.}
  \item{aspect}{either a logical indicating whether to adjust the aspect ratio, or a new ratio.}
  \item{xlim, ylim, zlim}{If not \code{NULL}, set clipping
limits for the plot.}
  \item{forceClipregion}{Force a clipping region to be used,
whether or not limits are given.}
  \item{decorate}{Whether to add bounding axes and other
  decorations.}
  \item{\dots}{additional parameters which will be passed to \code{\link{par3d}}, \code{\link{material3d}}
  or \code{\link{decorate3d}}.}
}
\value{
  \code{plot3d} is called for the side effect of drawing the plot; a vector
  of object IDs is returned.
}
\details{
\code{plot3d} is a partial 3D analogue of plot.default.

Missing values in the data are skipped, as in standard graphics.

If \code{aspect} is \code{TRUE}, aspect ratios of \code{c(1, 1, 1)} are passed to
\code{\link{aspect3d}}.  If \code{FALSE}, no aspect adjustment is done.  In other
cases, the value is passed to \code{\link{aspect3d}}.

With \code{type = "s"}, spheres are drawn centered at the specified locations.
The radius may be controlled by \code{size} (specifying the size relative
to the plot display, with the default \code{size = 3} giving a radius 
about 1/20 of the plot region) or \code{radius} (specifying it on the data scale
if an isometric aspect ratio is chosen, or on an average scale
if not). 
}
\section{Clipping}{
If any of \code{xlim}, \code{ylim} or \code{zlim} are specified,
they should be length two vectors giving lower and upper 
clipping limits for the corresponding coordinate.  \code{NA}
limits will be ignored.

If any clipping limits are given, then the data will be
plotted in a newly created subscene within the current one;
otherwise plotting will take place directly in the current
subscene.  This subscene is named \code{"clipregion"}
in the results.  This may affect the appearance of transparent
objects if some are drawn in the \code{plot3d} call and others after, 
as RGL will not attempt to depth-sort objects if they are
in different subscenes.  It is best to draw all overlapping 
transparent objects in the same subscene.  See the example 
in \code{\link{planes3d}}.  It will also affect the use
of \code{\link{clipplanes3d}}; clipping planes need to be in the 
same subscene as the objects being clipped.

Use \code{forceClipregion = TRUE} to force creation of this 
subscene even without specifying limits. 
}
\author{
  Duncan Murdoch
}
\seealso{
  \code{\link{plot.default}},  
  \code{\link{open3d}}, \code{\link{par3d}}.
  There are  \code{\link{plot3d.function}} and \code{\link{plot3d.deldir}} methods for plotting surfaces.
}
\examples{
  open3d()
  x <- sort(rnorm(1000))
  y <- rnorm(1000)
  z <- rnorm(1000) + atan2(x, y)
  plot3d(x, y, z, col = rainbow(1000))
}
\keyword{dynamic}