[R-sig-Geo] plot.gstatVariogram - overlay multiple models on a single variogram

Timothy W. Hilton hilton at meteo.psu.edu
Thu Dec 18 02:18:13 CET 2008


Hello,

Using gstat, I would like to overlay several different variogram
models onto a single empirical semivariogram.  I am having trouble
mastering the necessary lattice plotting commands.  Using an example
from this list (or maybe the docs for gstat; I'm not sure):

mypanel = function(x,y,...) {                                                 
  vgm.panel.xyplot(x,y,...)
}

require(gstat)
g = gstat(formula = log(zinc)~1, data = meuse)
v = variogram(log(zinc)~1,meuse)
vgm1 = fit.variogram(v,vgm(1, "Sph", 900,1))
vgm2 = fit.variogram(v,vgm(1, "Exp", 300,1))
print(plot(v, model=vgm1 ,panel=mypanel))


This plots the variogram with vgm1.  I would now like to overlay vgm2,
in a different color.  I have tried many variations on making model a
list, or trying to write a panel function that will plot the
variogram, then both models sequentially, but I can't get anything to
work.

Many thanks for any help,
Tim




More information about the R-sig-Geo mailing list