scaleZoom {ifultools} | R Documentation |
Returns the portion of a matrix based on the specified ranges of abscissa (x) and ordinate (y) values.
scaleZoom(x, y, z=NULL, zoom=NULL, logxy="y", xy.linked=FALSE, xlab="x", ylab="y", log.base=2)
x |
a numeric vector of abscissa values corresponding to the provided z matrix. |
y |
a numeric vector of ordinate values corresponding to the provided z matrix. |
log.base |
the base of the logarithm used to scale the output zoomed coordinates. See the help
for the logxy input for more details. Default: 2. |
logxy |
a character string indicating containing either or both of the characters "x"
and "y" . If the character "x" is present in the string, the logarithm of the resulting
zoomed x coordinate is returned use base log.base . A similar logic follows for the
presence of character "y" in the string. For example, to take the log10 of both the zoomed x- and
y-coordinates, one would set logxy="xy", log.base=10 . If logarithms are used, the xlab and
ylab strings are altered accordingly. Default: "y" . |
xlab |
character string defining x-label. Default: "x" . |
xy.linked |
a logical value. If TRUE , the algorithm used to
define the output (zoomed) x- and y-coordinates as follows:
Thus, both x- and y-zoom conditions must be met for both coordinates. Default: FALSE . |
ylab |
character string defining x-label. Default: "y" . |
z |
a matrix of numeric values whose x- and y-axis values are defined by the x
and y vectors, respectively. This argument may be NULL signifying that no z matrix
is present and (in this case) only the zoomed x and y coordinates will be returned
in the output. Default: NULL . |
zoom |
a four-element numeric vector containing the ranges to zoom into the
data in c(xmin, xmax, ymin, ymax) format. Default: NULL (no zoom). |
a named list containing the following components:
x |
The zoomed portion of the input x vector. |
y |
The zoomed portion of the input y vector. |
z |
The zoomed portion of the input z matrix, if z is not NULL . |
ix |
The indices of the original x vector which span the range specified by zoom[1:2] . |
iy |
The indices of the original y vector which span the range specified by zoom[3:4] . |
xlab |
A character string defining an appropriate x-label for the zoomed x-coordinate output. |
ylab |
A character string defining an appropriate y-label for the zoomed y-coordinate output. |
## create an image x <- y <- seq(-4*pi, 4*pi, len=50) r <- sqrt(outer(x^2, y^2, "+")) z <- cos(r^2)*exp(-r/6) image(x,y,z,col=gray((0:32)/32)) ## zoom in on one portion of that image and ## re-display zoom <- scaleZoom(x,y,z, zoom=c(-5,5,-1,10), logxy="") image(zoom$x, zoom$y, zoom$z, col=gray((0:32)/32))