Learn R Programming

fields (version 16.2)

surface.Krig: Plots a surface and contours

Description

Creates different plots of the fitted surface of a Krig object. This is a quick way to look at the fitted function over reasonable default ranges.

Usage

# S3 method for Krig
surface(object, grid.list = NULL, extrap = FALSE,
                 graphics.reset = NULL, xlab = NULL, ylab = NULL, main
                 = NULL, zlab = NULL, zlim = NULL, levels = NULL, type
                 = "C", nx = 80, ny = 80, col = viridisLite::viridis(256), ...)
# S3 method for mKrig
surface(
object, grid.list = NULL, extrap = FALSE,
                 graphics.reset = NULL, xlab = NULL, ylab = NULL, main
                 = NULL, zlab = NULL, zlim = NULL, levels = NULL, type
                 = "C", nx = 80, ny = 80, col = viridisLite::viridis(256), ...)

Arguments

object

A Krig object or an mKrig object.

grid.list

A list with as many components as variables describing the surface. All components should have a single value except the two that give the grid points for evaluation. If the matrix or data frame has column names, these must appear in the grid list. If grid.list is missing an the surface has just two dimensions the grid is based on the ranges of the observed data.

extrap

Extrapolation beyond the range of the data. If false only the convex hull of the observations is plotted. Default is false.

graphics.reset

Reset to original graphics parameters after function plotting.

type

Type of plot as a character. "p" perspective plot (persp). "c" contour plot (contour). "b" a two panel figure with perspective and contour plots. "I" image plot with legend strip (image.plot). "C" image plot with contours overlaid. Image with contour is the default.

main

Title of plot

xlab

x axis label

ylab

y axis label

zlab

z axis label if "p" or "b" type is used.

zlim

Z limits passed to persp

levels

Contour levels passed to contour.

nx

Number of grid points to evaluate surface on the horizontal axis (the x-axis).

ny

Number of grid points to evaluate surface on the vertical axis (the y-axis).

col

Color scale.

...

Any other plotting options.

Details

This function is essentially a combination of predictSurface and plot.surface. It may not always give a great rendition but is easy to use for checking the fitted surface. The default of extrap=F is designed to discourage looking at the estimated surface outside the range of the observations.

NOTE: that any Z covariates will b edropped and only the spatial part of the model will be evaluated.

See Also

Krig predictSurface, plot.surface, image.plot

Examples

Run this code
fit<- Krig(ChicagoO3$x,ChicagoO3$y, aRange=30)  # krig fit 

#Image plot of surface with nice, smooth  contours and shading

surface(fit, type="C", nx=128, ny=128) 
 

Run the code above in your browser using DataLab