Extract the pixel values of a pixel image at each point along a linear transect.
transect.im(X, ..., from="bottomleft", to="topright",
nsample=512, click=FALSE, add=FALSE, curve=NULL)
A pixel image (object of class "im"
).
Ignored.
Optional. Start point and end point of the transect.
Pairs of \((x,y)\) coordinates
in a format acceptable to xy.coords
,
or keywords "bottom"
, "left"
, "top"
,
"right"
, "bottomleft"
etc.
Integer. Number of sample locations along the transect.
Optional.
Logical value.
If TRUE
, the linear transect is determined interactively
by the user, who clicks two points on the current plot.
Logical. If click=TRUE
, this argument determines
whether to perform interactive tasks on the current plot (add=TRUE
)
or to start by plotting X
(add=FALSE
).
Optional. A specification of a curved transect. See the section on Curved Transect.
An object of class "fv"
which can be plotted.
If curve
is given, then the transect will be a curve.
The argument curve
should be a list with the following
arguments:
A function in the R language with one argument t
.
A numeric vector of length 2 giving the range of values
of the argument t
.
t
; defaults to "t"
.
(Optional) a character string giving a short
description of the function argument t
; defaults to
"curve parameter"
.
The function f
must return a 2-column matrix or data frame
specifying the spatial coordinates (x,y)
of locations along the
curve, determined by the values of the input argument t
.
The pixel values of the image X
along a line segment
will be extracted. The result is a function table ("fv"
object)
which can be plotted directly.
If click=TRUE
, then the user is prompted to click two points on
the plot of X
. These endpoints define the transect.
Otherwise, the transect is defined by the endpoints
from
and to
. The default is a diagonal transect from
bottom left to top right of the frame.
# NOT RUN {
Z <- bei.extra$elev
plot(transect.im(Z))
# }
Run the code above in your browser using DataLab