geoR (version 1.8-1)

image.kriging: Image or Perspective Plot with Kriging Results

Description

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

Usage

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

Arguments

x

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

locations

an \(n \times 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.

borders

an \(n \times 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.

values

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

coords.data

optional. If an \(n \times 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.

filled

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.

Value

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

Details

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

References

Further information on the package geoR can be found at: http://www.leg.ufpr.br/geoR.

See Also

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

Examples

# NOT RUN {
loci <- expand.grid(seq(0,1,l=51), seq(0,1,l=51))
kc <- krige.conv(s100, loc=loci,
                 krige=krige.control(cov.pars=c(1, .25)))
image(kc)
contour(kc)
image(kc)
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
image(kc, coords.data=s100$coords)
contour(kc,filled=TRUE,coords.data=s100$coords,color=terrain.colors)
#
# now dealing with borders
#
bor <- matrix(c(.4,.1,.3,.9,.9,.7,.9,.7,.3,.2,.5,.8),
              ncol=2)
# 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(cov.pars=c(1, .25)),
                 borders=bor)
image(kc1)
contour(kc1)
# 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)
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)

par(op)
# }