6.4 Spatial Trends

# Fig. 6.6.: xy-plot with spatial trend
library(StatDA)
data(moss)
data(kola.background)

pdf("fig-6-6.pdf",width=9,height=4.5)
par(mfrow=c(1,2),mar=c(4,4,2,2))

plotbg(map.col=c("gray","gray","gray","gray"), xlab="UTM east [m]", ylab="UTM north [m]",
cex.lab=1.2)

X=moss[,"XCOO"]
Y=moss[,"YCOO"]
points(X[Y<7600000 & Y>7500000],Y[Y<7600000 & Y>7500000],pch=3,cex=0.7)

x=(X[Y<7600000 & Y>7500000]-753970)/1000
y=log10(moss[Y<7600000 & Y>7500000,"Cu"])

plot(x,y,xlab="Distance from Monchegorsk [km]",ylab="Cu in Moss [mg/kg]", yaxt="n",
pch=3,cex=0.7, cex.lab=1.2)
axis(2,at=log10(a<-sort(c((10^(-50:50))%*%t(c(2,5,10))))),labels=a)
lines(smooth.spline(x,y),col=1,lwd=1.3)

dev.off()
# Fig. 6.7.: xy-plot with spatial trend (coast)
library(StatDA)
data(moss)
data(ohorizon)
data(kola.background)

pdf("fig-6-7.pdf",width=9,height=9)
par(mfrow=c(2,2),mar=c(4,4,2,2))

plotbg(map.col=c("gray","gray","gray","gray"), xlab="UTM east [m]", ylab="UTM north [m]",
cex.lab=1.3)

X=ohorizon[,"XCOO"]
Y=ohorizon[,"YCOO"]
points(X[X<460000],Y[X<460000],pch=3,cex=0.7)

x=abs((Y[X<460000]-max(Y)+2000)/1000)

y=ohorizon[X<460000,"Na"]
plot(x,y,xlab="Distance from coast [km]",ylab="Na in Moss [mg/kg]",pch=3,cex=0.7,cex.lab=1.3)
lines(smooth.spline(x,y),col=1,lwd=1.3)

y=ohorizon[X<460000,"Bi"]
plot(x,y,xlab="Distance from coast [km]",ylab="Bi in O-horizon [mg/kg]",pch=3,cex=0.7,cex.lab=1.3)
lines(smooth.spline(x,y,spar=0.7),col=1,lwd=1.3)

y=ohorizon[X<460000,"Mg"]
plot(x,y,xlab="Distance from coast [km]",ylab="Mg in O-horizon [mg/kg]",pch=3,cex=0.7,cex.lab=1.3)
lines(smooth.spline(x,y),col=1,lwd=1.3)

dev.off()
# fig. 6.8.: xy-plot with spatial trend (pH)
library(StatDA)
data(ohorizon)

pdf("fig-6-8.pdf",width=9,height=4.5)
par(mfrow=c(1,2),mar=c(4,4,2,2))

X=ohorizon[,"XCOO"]
Y=ohorizon[,"YCOO"]

x1=(X[Y<7600000 & Y>7500000]-753970)/1000
y1=ohorizon[Y<7600000 & Y>7500000,"pH"]
x2=abs((Y[X<460000]-max(Y)+2000)/1000)
y2=ohorizon[X<460000,"pH"]
y2<-y2[-65]
x2<-x2[-65]
plot(x2,y2,xlab="Distance from coast [km]",ylab="pH in O-horizon",pch=3,cex=0.7,cex.lab=1.2)
lines(smooth.spline(x2,y2,spar=0.8),col=1,lwd=1.3)

plot(x1,y1,xlab="Distance from Monchegorsk [km]",ylab="pH in O-horizon",pch=3,cex=0.7,cex.lab=1.2)
lines(smooth.spline(x1,y1),col=1,lwd=1.3)

dev.off()