GETXprofile {GEOmap} | R Documentation |
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.
GETXprofile(jx, jy, jz, LAB = "A", myloc = NULL, PLOT = FALSE, asp=1)
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 |
asp |
aspect ration for plotting, see par |
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 a list of x,z values representing the projected values along the cross section.
RX |
distance along cross section |
RZ |
values extracted from the elevation map |
The program is an auxiliary program provided to illustrate the RPMG interactive R analysis.
Jonathan M. Lees<jonathan.lees@unc.edu>
locator, image
####### 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)