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

Edzer Pebesma edzer.pebesma at uni-muenster.de
Thu Dec 18 08:03:32 CET 2008


Try:

mypanel = function(x,y,...) {                                                 
  vgm.panel.xyplot(x,y,...)
  panel.lines(variogramLine(vgm2,1500))
}

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))

--
Edzer

Timothy W. Hilton wrote:
> 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
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>   

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/
http://www.springer.com/978-0-387-78170-9 e.pebesma at wwu.de




More information about the R-sig-Geo mailing list