images in 3D frame | R Documentation |
image3D
adds an image in a 3-D plot.
image3D (x = NULL, y = NULL, z = NULL, ..., colvar = NULL,
phi = 40, theta = 40, col = NULL,
NAcol = "white", breaks = NULL, border = NA, facets = TRUE,
colkey = NULL, resfac = 1, panel.first = NULL,
clim = NULL, clab = NULL, bty = "b",
inttype = 1, add = FALSE, plot = TRUE)
x , y , z |
Matrix (2-D), vector, or one value containing the values where the image is to be plotted. At least one of them should be one number, as this will determine where the image is plotted, parallel to the (y-z) plane (x one number), to the (x-z) plane (y one number) or to the (z-y) plane (z one number). If two are vectors, the first vector should be of length equal to
|
colvar |
The variable used for coloring. |
col |
Color palette to be used for the |
NAcol |
Color to be used for |
breaks |
a set of finite numeric breakpoints for the colors; must have one more breakpoint than color and be in increasing order. Unsorted vectors will be sorted, with a warning. |
colkey |
A logical, The default is to draw the color key on side = 4, i.e. in the right margin.
If |
clab |
Only if |
clim |
Only if |
resfac |
Resolution factor, one value or a vector of two numbers, for
the x and y- values respectively. A value > 1 will increase the
resolution. For instance, if |
theta , phi |
The angles defining the viewing direction.
|
border |
The color of the lines drawn around the surface facets.
The default, |
facets |
If |
panel.first |
A |
bty |
The type of the box, the default only drawing background panels.
Only effective if the persp
argument ( |
inttype |
The interpolation type to create the polygons, either
taking the mean of the |
add |
Logical. If |
plot |
Logical. If |
... |
additional arguments passed to the plotting methods. The following persp arguments can be specified:
In addition, the perspbox arguments
Also the arguments The arguments after ... must be matched exactly. |
image3D
calls the surf3D function. The x, y, and z values are
expanded as a matrix.
Returns the viewing transformation matrix. See trans3D.
Karline Soetaert <karline.soetaert@nioz.nl>
surf3D for the function on which image3D
is based.
image2D for plot3D
s 2-D image function.
# save plotting parameters
pm <- par("mfrow")
## =======================================================================
## images in x, y, z plane
## =======================================================================
par(mfrow = c(2, 2))
# images in x, y, z plane
# We use colkey = list(plot = FALSE) to create room for a color key
image3D(y = seq(0, 1, 0.1), z = seq(0, 1, 0.1), x = 0.5,
col = "blue", xlim = c(0,1), colkey = list(plot = FALSE))
image3D(x = seq(0, 1, 0.1), z = seq(0, 1, 0.1), y = 0.5,
add = TRUE, col = "red", alpha = 0.2) # alpha makes it transparent
image3D(x = seq(0, 1, 0.1), y = seq(0, 1, 0.1), z = 0.5,
add = TRUE, col = "green")
colkey(col = c("green", "red", "blue"), clim = c(0.5, 3.5),
at = 1:3, labels = c("z", "y", "x"), add = TRUE)
#
image3D(z = 100, colvar = volcano, zlim = c(0, 150),
clab = c("height", "m"))
#
image3D( x = 0.5, colvar = volcano, xlim = c(0, 1),
ylim = c(0, 1), zlim = c(0, 1))
image3D( y = 0.5, colvar = volcano, add = TRUE)
#
image3D( z = 1, colvar = volcano,
x = seq(0, 1, length.out = nrow(volcano)),
y = seq(0, 1, length.out = ncol(volcano)),
xlim = c(0, 2), ylim = c(0, 2), zlim = c(0, 2))
image3D(y = 2, colvar = volcano, add = TRUE,
shade = 0.2,
x = seq(0, 1, length.out = nrow(volcano)),
z = seq(1, 2, length.out = ncol(volcano)))
image3D(x = 2, colvar = NULL, col = "orange", add = TRUE,
y = seq(0, 1, length.out = nrow(volcano)),
z = seq(1, 2, length.out = ncol(volcano)))
# reset plotting parameters
par(mfrow = pm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.