[R] soap film smoother
Simona Arcuti
simona.arcuti at gmail.com
Tue Mar 12 11:40:37 CET 2013
Dear all,
I'm trying to fit a soap film smoother by mgcv, accounting for a polygonal
boundary. Everything works well untill I plot the results, when I get the
right shape, but plot coordinates are exchanged. Function vis.gam() doesn't
run into the same problem. Here I enclose the script and attach an
essential R workspace. Can anybody provide some help or hints?
Regards,
SA
#####
# points, polygon, knots
plot(aa[[1]]$lon,aa[[1]]$lat,type="l")
points(knots,pch=20,col=2)
points(data$lon,data$lat,pch=20,col="blue")
#####
# data
den <- data$den
lon <- data$lon
lat <- data$lat
#####
# model
require(mgcv)
nmax <- 100
b <- gam(I(den^0.5)~s(lon,lat,k=30,bs="so",xt=list(bnd=aa,nmax=nmax)),
knots=knots)
#####
# default plot
x11()
plot(b)
# The plot shape is OK, but the coordinates are exchanged:
# lon is in the range of lat and vice-versa
More information about the R-help
mailing list