Learn R Programming

SpatialPosition (version 2.1.2)

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"))
)

Value

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

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.

See Also

stewart, rasterStewart, quickStewart, CreateGrid, CreateDistMatrix.

Examples

Run this code
data(hospital)
# Compute Stewart potentials from known points (hospital) on a
# grid defined by its resolution
mystewart <- stewart(knownpts = hospital, varname = "capacity",
                     typefct = "exponential", span = 1000, beta = 3,
                     resolution = 100, mask = paris)
# Create a raster of potentials values
mystewartraster <- rasterStewart(x = mystewart, mask = paris)
# 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