opa <- par(mfrow=c(1,2))
## pixel image
Z <- bei.extra$elev
plot(Z)
plot(transect(Z))
## function
U <- distfun(cells)
plot(U)
TU <- transect(U, from="left", to="right")
## show the transect position on the plot of U
SP <- attr(TU, "SamplePoints")
with(SP, lines(x,y,col=8, lwd=3))
## plot the transect values
plot(TU, main="transect(U, ...)")
par(opa)
Run the code above in your browser using DataLab