Cross sectional profile through a digital elevation map
Cross sectional profile through a digital elevation map
Example of how to use RPMG button functions. This example shows how to plot a DEM and interactively change the plot and find projected cross-sections through a surface.
jx, jy: locations of grid lines at which the values in 'jz' are measured.
jz: a matrix containing the values to be plotted
LAB: Alphanumeric (A-Z) for labeling a cross section
myloc: Out put of Locator function
PLOT: logical. Plot is created if TRUE
NEWDEV: logical. Plot is on a new device if TRUE
asp: aspect ration for plotting, see par
Details
The program uses a similar input format as image or contour, with structure from the locator() function of x and y coordinates that determine where the cross section is to be extracted.
Returns
Returns a list of x,z values representing the projected values along the cross section. - RX: distance along cross section
The program is an auxiliary program provided to illustrate the RPMG interactive R analysis.
See Also
locator, image
Examples
## Not run:####### get data data(volcano)#### extract dimensions of image nx = dim(volcano)[1] ny = dim(volcano)[2]### establish units of image jx =10*seq(from=0, to=nx-1) jy =10*seq(from=0, to=ny-1)#### set a letter for the cross section LAB = LETTERS[1]### coordinates of cross section on image### this is normally set by using the locator() function x1 =76.47351 y1 =231.89055 x2 =739.99746 y2 =464.08185## extract and plot cross section GETXprofile(jx, jy, volcano, myloc=list(x=c(x1, x2), y=c(y1, y2)), LAB=LAB, PLOT=TRUE)## End(Not run)