Learn R Programming

SpatialPosition (version 1.0)

plotStewart: Plot a Stewart Raster

Description

This function plots the raster produced by the rasterStewart function.

Usage

plotStewart(x, add = FALSE, breaks = NULL, typec = "equal", nclass = 5,
  legend.rnd = 0, col = colorRampPalette(c("#FEA3A3", "#980000")))

Arguments

x
raster; output of the rasterStewart function.
add
logical; if TRUE the raster is added to the current plot, if FALSE the raster is displayed in a new plot.
breaks
numeric; vector of break values to map. If used, this parameter overrides typec and nclass parameters
typec
character; either "equal" or "quantile", how to discretize the values.
nclass
numeric (integer), number of classes.
legend.rnd
numeric (integer); number of digits used to round the values displayed in the legend.
col
function; color ramp function, such as colorRampPalette.

Value

  • Display the raster nicely and return the list of break values (invisible).

See Also

stewart, rasterStewart, plotStewart, contourStewart, CreateGrid, CreateDistMatrix.

Examples

Run this code
data(spatData)
# Compute Stewart potentials from known points (spatPts) on a
# grid defined by its resolution
mystewart <- stewart(knownpts = spatPts, varname = "Capacite",
                     typefct = "exponential", span = 1000, beta = 3,
                     resolution = 50, longlat = FALSE, mask = spatMask)
# Create a raster of potentials values
mystewartraster <- rasterStewart(x = mystewart, mask = spatMask)
# Plot stewart potentials nicely
plotStewart(x = mystewartraster, add = FALSE, nclass = 5)
# Can be used to obtain break values
break.values <- plotStewart(x = mystewartraster, add = FALSE, nclass = 5)
break.values

Run the code above in your browser using DataLab