xyz.coords
Extracting Plotting Structures
Utility for obtaining consistent x, y and z coordinates and labels for three dimensional (3D) plots.
 Keywords
 dplot
Usage
xyz.coords(x, y = NULL, z = NULL, xlab = NULL, ylab = NULL, zlab = NULL, log = NULL, recycle = FALSE)
Arguments
 x, y, z
 the x, y and z coordinates of a set of points.
Both
y
andz
can be left atNULL
. In this case, an attempt is made to interpretx
in a way suitable for plotting.If the argument is a formula
zvar ~ xvar + yvar
,xvar
,yvar
andzvar
are used as x, y and z variables; if the argument is a list containing componentsx
,y
andz
, these are assumed to define plotting coordinates; if the argument is a matrix ordata.frame
with three or more columns, the first is assumed to contain the x values, the 2nd the y ones, and the 3rd the z ones  independently of any column names thatx
may have.Alternatively two arguments
x
andy
can be provided (leavingz = NULL
). One may be real, the other complex; in any other case, the arguments are coerced to vectors and the values plotted against their indices.  xlab, ylab, zlab
 names for the x, y and z variables to be extracted.
 log
 character,
"x"
,"y"
,"z"
or combinations. Sets negative values toNA
and gives a warning.  recycle
 logical; if
TRUE
, recycle (rep
) the shorter ones ofx
,y
orz
if their lengths differ.
Value

A list with the components
 x
 numeric (i.e.,
double
) vector of abscissa values.  y
 numeric vector of the same length as
x
.  z
 numeric vector of the same length as
x
.  xlab
character(1)
orNULL
, the axis label ofx
. ylab
character(1)
orNULL
, the axis label ofy
. zlab
character(1)
orNULL
, the axis label ofz
.
See Also
xy.coords
for 2D.
Examples
library(grDevices)
xyz.coords(data.frame(10*1:9, 4), y = NULL, z = NULL)
xyz.coords(1:5, stats::fft(1:5), z = NULL, xlab = "X", ylab = "Y")
y < 2 * (x2 < 10 + (x1 < 1:10))
xyz.coords(y ~ x1 + x2, y = NULL, z = NULL)
xyz.coords(data.frame(x = 1:9, y = 2:12, z = 3:13), y = NULL, z = NULL,
log = "xy")
##> Warning message: 2 x values <= 0 omitted ...