Learn R Programming

R2BayesX (version 1.1-5)

plotmap: Plot Maps

Description

The function takes a list polygons and draws the corresponding map. Different colors for each polygon can be used. Typically used for objects of class "mrf.bayesx" and "random.bayesx" returned from function bayesx and read.bayesx.output.

Usage

plotmap(map, x = NULL, id = NULL, c.select = NULL, legend = TRUE,
  missing = TRUE, swap = FALSE, range = NULL, names = FALSE,
  values = FALSE, col = NULL, ncol = 100, breaks = NULL,
  cex.legend = 1, cex.names = 1, cex.values = cex.names, digits = 2L,
  mar.min = 2, add = FALSE, interp = FALSE, grid = 200,
  land.only = FALSE, extrap = FALSE, outside = FALSE, type = "interp",
  linear = FALSE, k = 40, p.pch = 15, p.cex = 1, shift = NULL,
  trans = NULL, ...)

Arguments

map

the map to be plotted, the map object must be a list of matrices with first column indicating the x coordinate and second column the y coordinate each, also see polygon.

x

a matrix or data frame with two columns, first column indicates the region and second column the the values which will define the background colors of the polygons, e.g. fitted values from bayesx. More columns are possible, e.g. quantiles, which can accessed with argument se.

id

if argument x is a vector, argument id should contain a character vector of the same length of x with entries indicating the polygon the \(i\)-th value of x belongs to, i.e. id must contain the same names as polygon names in map.

c.select

select the column of the data in x which should be used for plotting, may be an integer or character with the corresponding column name.

legend

if set to TRUE, a legend will be shown.

missing

should polygons be plotted for which no data is available in x?

swap

if set to TRUE, colors will be represented in reverse order.

range

specify the range of values in x which should enter the plot, e.g. only values between -2 and 2 are of interest then range = c(-2, 2).

names

if set to TRUE the name for each polygon will also be plotted at the centroids of the corresponding polygons.

values

if set to TRUE the corresponding values for each polygon will also be plotted at the centroids of the polygons.

col

the color of the surface, may also be a function, e.g. col.surface = heat.colors.

ncol

the number of different colors that should be generated if col is a function.

breaks

a set of breakpoints for the colors: must give one more breakpoint than ncol.

cex.legend

text size of the numbers in the legend.

cex.names

text size of the names if names = TRUE.

cex.values

text size of the names if values = TRUE.

digits

specifies the legend decimal places.

mar.min

Controls the definition of boundaries. Could be either NULL for individual settings of mar or a value which defines mar as follows: The boundaries will be calculated according to the height to width ratio of the map with minimal boundary mar.min.

add

if set to TRUE, the map will be added to an existing plot.

interp

logical. Should the values provided in argument x be interpolated to obtain a smooth colored map.

grid

integer. Defines the number of grid cells to be used for interpolation.

land.only

if set to TRUE, only interpoltated pixels that cover land are drawn, see also function map.where.

extrap

logical. Should interpolations be computed outside the observation area (i.e., extrapolated)?

outside

logical. Should interpolated values outside the boundaries of the map be plotted.

type

character. Which type of interpolation metjod should be used. The default is type = "interp", see function interp. The two other options are type = "mba", which calls function mba.surf of package MBA, or type = "mgcv", which uses a spatial smoother withing package mgcv for interpolation. The last option is definitely the slowest, since a full regression model needs to be estimated.

linear

logical. Should linear interpolation be used withing function interp?

k

integer. The number of basis functions to be used to compute the interpolated surface when type = "mgcv".

p.pch

numeric. The point size of the grid cells when using interpolation.

p.cex

numeric. The size of the grid cell points whein using interpolation.

shift

numeric. Constant to be added to the smooth before plotting.

trans

function to be applied to the smooth before plotting, e.g., to transform the plot to the response scale.

...

parameters to be passed to colorlegend and others, e.g. change the border of the polygons and density, see polygon. Please see the exmaples.

Author

Nikolaus Umlauf, Thomas Kneib, Stefan Lang, Achim Zeileis.

See Also

plot.bayesx, read.bnd, colorlegend.