Loading ...
Sorry, an error occurred while loading the content.

[ai-geostats] gstat in R a couple of simple variogram plot questions

Expand Messages
  • bob sandefur
    Hi- I was plotting some variograms with gstat in R with: s
    Message 1 of 2 , Aug 25, 2004
    • 0 Attachment

      Hi-

       

      I was plotting some variograms with gstat in R

      with:

       

      s <- whar=="CUT.67"

      xv<-x[s]

      yv<-y[s]

      zv<-z[s]

      gv<-CUT[s]

      jdf<-data.frame(xv,yv,zv,gv)

      jgs<-gstat(id = "CUT.67", formula = gv~1, locations = ~xv+yv+zv, data=jdf)

      jgv<-variogram(jgs,cutoff=400,width=8)

      jgvf <- fit.variogram(jgv, model = vgm(1, "Exp", 900, 1))

      plot(jgv, model = jgvf,col="black",pch=15,main="MyVariogram") # view result

      abline(var(gv),0) # line is relative to bottom of plot ??? not 0,0

       

      plot(jgv$dist,jgv$gamma)

      abline(var(gv),0) # line is where it belongs

       

      Questions are:

      1.)     How do I get variance line where it belongs?

      2.)     Can I change the background color of plot from gray?

       

      I looked briefly at docs and on net. Before I look at source, has anyone face or solved these problems?

       

      Thanx

       

       

      Robert (Bob) L. Sandefur PE

      Senior Geostatistician / Reserve Analyst

      CAM

      200 Union Suite G-13

      Lakewood, Co

      80228

       

      rsandefur@...

       

      303 472-3240 (cell) <-best  choice

       

      303 716-1617 ext 14

       

    • Edzer J. Pebesma
      ... By using your second plotting approach, or by modifying the source. ... lset(theme = col.whitebg()) For those interested: plot(jgv, ...) calls the function
      Message 2 of 2 , Aug 25, 2004
      • 0 Attachment


        bob sandefur wrote:

        Hi-

         

        I was plotting some variograms with gstat in R

        ...

        plot(jgv, model = jgvf,col="black",pch=15,main="MyVariogram") # view result

        abline(var(gv),0) # line is relative to bottom of plot ??? not 0,0

         

        plot(jgv$dist,jgv$gamma)

        abline(var(gv),0) # line is where it belongs

         

        Questions are:

        1.)     How do I get variance line where it belongs?

        By using your second plotting approach, or by modifying the source.

        2.)     Can I change the background color of plot from gray?

        lset(theme = col.whitebg())

        For those interested: plot(jgv, ...) calls the function plot.gstatVariogram,
        because jgv is of class gstatVariogram. This function is a wrapper around
        xyplot, which is part of the Lattice/Trellis plotting system. The second
        approach calls the traditional plotting engine, which lets you add lines,
        text etc. in later commands, as in abline().

        I chose using xyplot where possible because it is extendible to
        more complex graphs, e.g. directional cross variograms, such as shown in
        http://www.galukken.demon.nl/g.png (where colour denotes direction).

        Not that I like that plot particularly, but IMHO the value of conditioning
        plots in geostatistical analysis is hard to overestimate. Further reading:

        Pebesma, Edzer J, 2004. Multivariable geostatistics in S: the gstat package.
        Computers & Geosciences 30: 683-691; reprints upon request.

        Best regards,
        --
        Edzer

      Your message has been successfully submitted and would be delivered to recipients shortly.