PlotPremReg: Plot Premium Regions CH

View source: R/bfsMaps.R

PlotPremRegR Documentation

Plot Premium Regions CH

Description

Plot premium regions in Switzerland.

Usage

PlotPremReg(id = NULL, col = NA, pbg = "white", main = "",
            border = "grey", lwd = 1,
            labels = NULL, tmtxt = TRUE, add = FALSE, ...)

Arguments

id

vector of region ids. The premium regions can be addressed via their their abbreviation: "AG0", "AI0", "AR0", "BE1", ...

col

vector of colors, defining the colors of the region area.

pbg

color for the plot background.

main

main title in the plot.

border

vector of colors for region borders. Default is "grey30".

lwd

linewidth for region borders.

labels

optional labels to be placed in the map, by default the centroids of the map is used for that.

tmtxt

logical, should the copyright text be displayed. Default is TRUE.

add

default FALSE; if TRUE, add to existing plot.

...

the dots are passed to the plot command.

Value

A list containing x and y components which are the centroids of the plotted spatial units.

Author(s)

Andri Signorell <andri@signorell.net>

See Also

PlotCH, d.bfsrg

Examples

# Note:
#   The examples can not be run without having the map data installed before!
try( {

preg_x <- sort(unique(d.bfsrg$preg_x))

PlotPremReg(id=preg_x, border="grey60",
            col=c("white","olivedrab4", "olivedrab3", "olivedrab2")[
                StrVal(preg_x,as.numeric=T)+1],
            main="Prämienregionen CH")

legend(x="topleft", fill=c("white","olivedrab4","olivedrab3","olivedrab2"),
       cex=0.8,
       legend=c("Region 0","Region 1","Region 2","Region 3") )

AddLakes()

# plot all premium regions
# find all regions
d.bfsrg$preg_x <- paste0(d.bfsrg$kt_x, d.bfsrg$preg_c)
preg <- unique(d.bfsrg$preg_x)

cols <- c("white","darkolivegreen3", "darkolivegreen2", "darkolivegreen1")

PlotPremReg(preg, cols[ZeroIfNA(StrVal(preg, as.numeric = T))+1], labels =NA)
PlotKant(add=TRUE, border="grey55")
AddLakes()

# plot some selected premium regions
PlotPremReg(c("ZH1", "GR2"), c("blue", "yellow"), labels=TRUE)
PlotKant(add=TRUE, border="grey55")
AddLakes()
})


bfsMaps documentation built on July 9, 2023, 5:57 p.m.