R: Extract (x, y, z) coordinates, where z is a matrix

xyzmat.coords {squash} | R Documentation

## Extract (x, y, z) coordinates, where z is a matrix

### Description

Extract (x, y, z) plotting coordinates, where z is a matrix.

### Usage

    xyzmat.coords(x = NULL, y = NULL, z = NULL,
        xlab = NULL, ylab = NULL, zlab = NULL,
        xds = NULL, yds = NULL, zds = NULL)

### Arguments

`x, y` | Numeric vectors.
`z` | A matrix
`xlab, ylab, zlab` | Labels
`xds, yds, zds` | Results from `deparse(substitute(x))` (etc.); see below.

### Details

This function is similar to `xyz.coords`, except that this function accepts a matrix for `z`.

If `x` is the same length as `nrow(z)`, `x` will be taken as the points at which the `z` values were sampled. If `x` is the length of `nrow(z) + 1`, `x` is taken as the breakpoints between bins. If `x` is missing, the matrix indices (`1:nrow(z)`) will be used. Similarly for `y` and the columns of `z`.

For convenience, the matrix can supplied as the `x` argument. Or, `x` can be a list with elements including {x, y, z, xlab, ylab, zlab}.

When this function is used inside a higher-level plotting function, the arguments `xds`, `yds`, and `zds` should be set to `deparse(substitute(x))` (etc.) so that the function can generate informative default axis labels. For example, see the code for `colorgram`.

### Value

A list with the following components:

`x` | X coordinates
`y` | Y coordinates
`z` | Z matrix
`xlab` | Label for X axis
`ylab` | Label for Y axis
`zlab` | Label for Z axis

### Examples

      ##
      str(volcano)
      volcano.xyzmat <- xyzmat.coords(volcano)
      str(volcano.xyzmat)

[Package squash version 1.0.8 Index]