| Line 95... |
Line 95... |
| 95 |
\code{VT}, a \eqn{4 \times 4}{4 x 4} matrix suitable for projecting 3D
|
95 |
\code{VT}, a \eqn{4 \times 4}{4 x 4} matrix suitable for projecting 3D
|
| 96 |
coordinates \eqn{(x,y,z)} into the 2D plane using homogeneous 4D
|
96 |
coordinates \eqn{(x,y,z)} into the 2D plane using homogeneous 4D
|
| 97 |
coordinates \eqn{(x,y,z,t)}. It can be used to superimpose
|
97 |
coordinates \eqn{(x,y,z,t)}. It can be used to superimpose
|
| 98 |
additional graphical elements on the 3D plot, by
|
98 |
additional graphical elements on the 3D plot, by
|
| 99 |
\code{\link{lines}()} or \code{\link{points}()}, using the
|
99 |
\code{\link{lines}()} or \code{\link{points}()}, using the
|
| 100 |
function \code{\link{trans3d}()}.
|
100 |
function \code{\link{trans3d}()}.
|
| 101 |
}
|
101 |
}
|
| 102 |
\details{
|
102 |
\details{
|
| 103 |
The plots are produced by first transforming the (x,y,z)
|
103 |
The plots are produced by first transforming the (x,y,z)
|
| 104 |
coordinates to the interval [0,1] using the limits supplied or
|
104 |
coordinates to the interval [0,1] using the limits supplied or
|
| 105 |
computed from the range of the data. The surface is then viewed
|
105 |
computed from the range of the data. The surface is then viewed
|
| Line 136... |
Line 136... |
| 136 |
\emph{The New S Language}.
|
136 |
\emph{The New S Language}.
|
| 137 |
Wadsworth & Brooks/Cole.
|
137 |
Wadsworth & Brooks/Cole.
|
| 138 |
}
|
138 |
}
|
| 139 |
\seealso{
|
139 |
\seealso{
|
| 140 |
\code{\link{contour}} and \code{\link{image}}; \code{\link{trans3d}}.
|
140 |
\code{\link{contour}} and \code{\link{image}}; \code{\link{trans3d}}.
|
| 141 |
|
141 |
|
| 142 |
Rotatable 3D plots can be produced by package \CRANpkg{rgl}: other
|
142 |
Rotatable 3D plots can be produced by package \CRANpkg{rgl}: other
|
| 143 |
ways to produce static perspective plots are available in packages
|
143 |
ways to produce static perspective plots are available in packages
|
| 144 |
\CRANpkg{lattice} and \CRANpkg{scatterplot3d}.
|
144 |
\CRANpkg{lattice} and \CRANpkg{scatterplot3d}.
|
| 145 |
}
|
145 |
}
|
| 146 |
\examples{
|
146 |
\examples{
|
| Line 194... |
Line 194... |
| 194 |
y <- seq(-1.95, 1.95, length = 35)
|
194 |
y <- seq(-1.95, 1.95, length = 35)
|
| 195 |
z <- outer(x, y, function(a, b) a*b^2)
|
195 |
z <- outer(x, y, function(a, b) a*b^2)
|
| 196 |
nrz <- nrow(z)
|
196 |
nrz <- nrow(z)
|
| 197 |
ncz <- ncol(z)
|
197 |
ncz <- ncol(z)
|
| 198 |
# Create a function interpolating colors in the range of specified colors
|
198 |
# Create a function interpolating colors in the range of specified colors
|
| 199 |
jet.colors <- colorRampPalette( c("blue", "green") )
|
199 |
jet.colors <- colorRampPalette( c("blue", "green") )
|
| 200 |
# Generate the desired number of colors from this palette
|
200 |
# Generate the desired number of colors from this palette
|
| 201 |
nbcol <- 100
|
201 |
nbcol <- 100
|
| 202 |
color <- jet.colors(nbcol)
|
202 |
color <- jet.colors(nbcol)
|
| 203 |
# Compute the z-value at the facet centres
|
203 |
# Compute the z-value at the facet centres
|
| 204 |
zfacet <- z[-1, -1] + z[-1, -ncz] + z[-nrz, -1] + z[-nrz, -ncz]
|
204 |
zfacet <- z[-1, -1] + z[-1, -ncz] + z[-nrz, -1] + z[-nrz, -ncz]
|