image.kriging | R Documentation |
Plots image or perspective plots with results of the kriging calculations.
## S3 method for class 'kriging' image(x, locations, borders, values = x$predict, coords.data, x.leg, y.leg, ...) ## S3 method for class 'kriging' contour(x, locations, borders, values = x$predict, coords.data, filled=FALSE, ...) ## S3 method for class 'kriging' persp(x, locations, borders, values = x$predict, ...)
x |
an object of the class |
locations |
an n x 2 matrix with the
coordinates of the prediction locations, which should define a
regular grid
in order to be plotted by |
borders |
an n x 2 matrix with the
coordinates defining the borders of a region inside the grid defined
by |
values |
a vector with values to be plotted. Defaults to |
coords.data |
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. |
filled |
logical. If |
... |
further arguments to be passed to the functions
|
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. paulojus@leg.ufpr.br,
Peter J. Diggle p.diggle@lancaster.ac.uk.
Further information on the package geoR can be found at:
http://www.leg.ufpr.br/geoR/.
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(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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.