drawmap: Drawing Geographical Information

View source: R/drawmap.R

drawmapR Documentation

Drawing Geographical Information

Description

Visualises variables that are spatially aligned according to a given map object. Each of the regions in a map will be coloured accoring to the value of the variable.

Usage

drawmap(data, map, regionvar=2, plotvar=3, limits, cols="hcl", nrcolors=100, 
        swapcolors=FALSE, pcat=FALSE,
        hcl.par=list(h=c(120, 0), c=60, l=c(45,60), power=1.2), 
        hsv.par=list(s=1, v=1), legend=TRUE, drawnames=FALSE, cex.names=0.7, 
        cex.legend=0.7, mar.min=2, density=15, ...)

Arguments

data

Either the name of a file or a data frame containing the variables to be visualised. If missing, the map will be visualised without superposition of any further information

map

Map object containing the required boundary information (as obtained by a call to read.bnd

regionvar

Defines the variable specifying the geographical regions. Either the name of a variable in data or the index of the corresponding column.

plotvar

Defines the variable that should be visualised. Either the name of a variable in data or the index of the corresponding column.

limits

Restricts (or extends) the coloring scheme to a range of values.

cols

Color scheme to be employed. Could be either a vector of colors or one out of the following pre-defined schemes: hcl, hsv, grey

nrcolors

Number of colors (only meaningful when using one of the pre-defined colour schemes).

swapcolors

Reverse the order of colors (works also with user-specified colours but will be most usefule with the pre-defined schemes).

pcat

Option for the visualisation of posterior probabilities. In this case, a three-colour scheme representing significantly positive, insignificant and significantly negative values.

hcl.par

Parameters for the hcl colour scheme (see the documentation of diverge_hcl in package vcd for details).

hsv.par

Parameters for the hsv colour scheme (see the documentation of hsv for details).

legend

Should a legend be added to the figure?

drawnames

Adds the name of each region as a text label to the plot. In most cases the result will be confusing but may be useful when checking the validity of a map.

cex.names

Magnification to be used for the names (if drawnames=TRUE).

cex.legend

Magnification to be used for the legend.

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.

density

Regions without data will be visualised with diagonal stripes. density defines how dense the stripes should be.

...

Further arguments to be passed to the plot calls that visualise the region boundaries (probably not useful at all).

Author(s)

Felix Heinzl, Thomas Kneib, Andreas Brezger

See Also

read.bnd

Examples

germany <- read.bnd(system.file("examples/germany.bnd", package="BayesX"))
drawmap(map=germany)
drawmap(map=germany, drawnames=TRUE)

res <- read.table(system.file("examples/spatial_f_regions_spatial.res", 
                              package="BayesX"), header=TRUE)

drawmap(res, map=germany)
drawmap(res, map=germany, limits=c(-2,4))
drawmap(res, map=germany, regionvar="regions", plotvar="pmed")
drawmap(res, map=germany, legend=FALSE)
drawmap(res, map=germany, legend=FALSE, main="spatial effect")

drawmap(res, map=germany, cols="hsv")
drawmap(res, map=germany, swapcolors=TRUE, cols="hsv")
drawmap(res, map=germany, cols="grey")
drawmap(res, map=germany,
        cols=c('darkgreen','green','yellow','orange','red','darkred'))

drawmap(res, map=germany, pcat=TRUE, cols="hcl")
drawmap(res, map=germany, pcat=TRUE, cols="hsv")
drawmap(res, map=germany, pcat=TRUE, cols="grey")

drawmap(res, map=germany, nrcolors=10, cols="hcl")
drawmap(res, map=germany, nrcolors=10, cols="hsv")
drawmap(res, map=germany, nrcolors=10, cols="grey")

drawmap(res, map=germany, cols="hcl",
        hcl.par=list(h=c(0,120), c=60, l=c(45,90), power=1.2))
drawmap(res, map=germany, cols="hcl",
        hcl.par=list(h=c(300,120), c=60, l=c(45,90), power=1.2))
drawmap(res, map=germany, cols="hcl",
        hcl.par=list(h=c(40,260), c=60, l=c(45,90), power=1.2))
drawmap(res, map=germany, cols="hsv", hsv.par=list(s=0.7, v=0.7))

BayesX documentation built on Oct. 20, 2023, 9:11 a.m.