surf.spline.smooth: Quick surface smoothing with thin plate spline

Description Usage Arguments Examples

View source: R/surf.smooth.spline.R

Description

Perform the fit of the provided data to a thin plate spline surface as implemented in the function Tps() of package Fields and return the prediction of the smoothed surface.

Usage

1
surf.spline.smooth(x, y, z, reshape = F, nx = 80, ny = 80, ...)

Arguments

x,y,z

surface data

reshape

reshape if the provided data are not in a format good for Tps() (i.e. melt) (default F)

nx,ny

grid for the final smoothed surface, supplied to predict.surface()

...

additional arguments passed to smooth.spline

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
pmfmatrix <- acast(pmf, xyK3 ~ zK3 )
pmf.x <- as.numeric( rownames(pmfmatrix) )
pmf.y <- as.numeric( colnames(pmfmatrix) )
pmf.z <- pmfmatrix
## setting ylimits before smoothing...
xmin <- -1
xmax <- 6
ymin <- -17
ymax <- -3
id.x <- which(pmf.x>xmin & pmf.x<xmax)
id.y <- which(pmf.y>ymin & pmf.y<ymax)

## smoothing
surf <- surf.spline.smooth(pmf.x[id.x], pmf.y[id.y], pmf.z[id.x,id.y], reshape=T, nx=70, ny=70)
fillcont.lines(surf$x, surf$y, surf$z-min(na.omit(surf$z)),border=F, Nlev=100,scaleLev=scaleLev, color=palette.redtoblue, ylab=expression(z[K3]), xlab=expression(xy[K3]))

s-cosseddu/RMD documentation built on May 28, 2019, 10:46 a.m.