Images in 3D plots.
Description
image3D
adds an image in a 3D plot.
Usage
1 2 3 4 5 6 
Arguments
x, y, z 
Matrix (2D), 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 (yz) plane (x one number), to the (xz) plane (y one number) or to the (zy) 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. 
Details
image3D
calls the surf3D function. The x, y, and z values are
expanded as a matrix.
Value
Returns the viewing transformation matrix. See trans3D.
Author(s)
Karline Soetaert <karline.soetaert@nioz.nl>
See Also
surf3D for the function on which image3D
is based.
image2D for plot3D
s 2D image function.
Examples
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  # 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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.