path.profile | R Documentation |
Computes and plots the depth/altitude along a transect or path
path.profile(path,bathy,plot=FALSE, ...)
path |
2-columns matrix of longitude and latitude as obtained from |
bathy |
bathymetric data matrix of class |
plot |
logical. Should the depth profile be plotted? |
... |
when |
a four-columns matrix containing longitude, latitude, kilometric distance from the start of a route and depth for a set of points along a route. Optionally (i.e. when plot=TRUE
) a bivariate plot of depth against the kilometric distance from the starting point of a transect or least cost path.
Benoit Simon-Bouhet
plotProfile
# Loading an object of class bathy and a data.frame of locations
require(mapdata)
data(hawaii)
data(hawaii.sites)
# Preparing a color palette for the bathymetric map
pal <- colorRampPalette(c("black","darkblue","blue","lightblue"))
# Plotting the bathymetric data and the path between locations
# (the path starts on location 1)
plot(hawaii,image=TRUE,bpal=pal(100),col="grey40",lwd=.7,
main="Bathymetric map of Hawaii")
map("worldHires",res=0,fill=TRUE,col=rgb(.8,.95,.8,.7),add=TRUE)
lines(hawaii.sites,type="o",lty=2,lwd=2,pch=21,
col="yellow",bg=col2alpha("yellow",.9),cex=1.2)
text(hawaii.sites[,1], hawaii.sites[,2],
lab=rownames(hawaii.sites),pos=c(3,3,4,4,1,2),col="yellow")
# Computing and plotting the depth profile for this path
profile <- path.profile(hawaii.sites,hawaii,plot=TRUE,
main="Depth profile along the path\nconnecting the 6 sites")
summary(profile)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.