image.kriging: Image or Perspective Plot with Kriging Results

image.krigingR Documentation

Image or Perspective Plot with Kriging Results


Plots image or perspective plots with results of the kriging calculations.


## S3 method for class 'kriging'
image(x, locations, borders, values = x$predict,
    , x.leg, y.leg, ...)
## S3 method for class 'kriging'
contour(x, locations, borders, values = x$predict,
    , filled=FALSE, ...)
## S3 method for class 'kriging'
persp(x, locations, borders, values = x$predict, ...)



an object of the class kriging, typically with the output of the functions krige.conv or ksline.


an n x 2 matrix with the coordinates of the prediction locations, which should define a regular grid in order to be plotted by image or persp. By default does not need to be provided and evaluates the attribute "prediction.locations" from the input object.


an n x 2 matrix with the coordinates defining the borders of a region inside the grid defined by locations. Elements in the argument values are assigned to locations internal to the borders and NA's to the external ones.


a vector with values to be plotted. Defaults to obj$predict.

optional. If an n x 2 matrix with the data coordinates is provided, points indicating the data locations are included in the plot.

x.leg, y.leg

limits for the legend in the horizontal and vertical directions.


logical. If FALSE the function contour is used otherwise filled.contour. Defaults to FALSE.


further arguments to be passed to the functions image, contour, filled.contour, persp or legend.krige. For instance, the argument zlim can be used to set the the minimum and maximum ā€˜zā€™ values for which colors should be plotted. See documentation for those function for possible arguments.


plot1d and prepare.graph.kriging are auxiliary functions called by the others.


An image or perspective plot is produced o the current graphics device. No values are returned.


Paulo J. Ribeiro Jr.,
Peter J. Diggle


Further information on the package geoR can be found at:

See Also

krige.conv and ksline for kriging calculations. Documentation for image, contour, filled.contour and persp contain basic information on the plotting functions.


loci <- expand.grid(seq(0,1,l=51), seq(0,1,l=51))
kc <- krige.conv(s100, loc=loci,
                 krige=krige.control(, .25)))
contour(kc, add=TRUE, nlev=21)
persp(kc, theta=20, phi=20)
contour(kc, filled=TRUE)
contour(kc, filled=TRUE, color=terrain.colors)
contour(kc, filled=TRUE, col=gray(seq(1,0,l=21)))
# adding data locations
# now dealing with borders
bor <- matrix(c(.4,.1,.3,.9,.9,.7,.9,.7,.3,.2,.5,.8),
# plotting just inside borders
image(kc, borders=bor)
contour(kc, borders=bor)
image(kc, borders=bor)
contour(kc, borders=bor, add=TRUE)
contour(kc, borders=bor, filled=TRUE, color=terrain.colors)
# kriging just inside borders
kc1 <- krige.conv(s100, loc=loci,
                 krige=krige.control(, .25)),
# avoiding the borders 
image(kc1, borders=NULL)
contour(kc1, borders=NULL)

op <- par(no.readonly = TRUE)
par(mfrow=c(1,2), mar=c(3,3,0,0), mgp=c(1.5, .8,0))
image(kc, val=sqrt(kc$krige.var))

# different ways to add the legends and pass arguments:
image(kc, ylim=c(-0.2, 1), x.leg=c(0,1), y.leg=c(-0.2, -0.1))
image(kc, val=kc$krige.var, ylim=c(-0.2, 1))
legend.krige(y.leg=c(-0.2,-0.1), x.leg=c(0,1), val=sqrt(kc$krige.var))

image(kc, ylim=c(-0.2, 1), x.leg=c(0,1), y.leg=c(-0.2, -0.1), cex=1.5)
image(kc, ylim=c(-0.2, 1), x.leg=c(0,1), y.leg=c(-0.2, -0.1), offset.leg=0.5)

image(kc, xlim=c(0, 1.2))
legend.krige(x.leg=c(1.05,1.1), y.leg=c(0,1), kc$pred, vert=TRUE)
image(kc, xlim=c(0, 1.2))
legend.krige(x.leg=c(1.05,1.1), y.leg=c(0,1),kc$pred, vert=TRUE, off=1.5, cex=1.5)


geoR documentation built on Aug. 9, 2022, 5:11 p.m.

Related to image.kriging in geoR...