Learn R Programming

bfsMaps (version 1.99.3)

PlotCH: Plot a Map of Switzerland

Description

Simple map plot of Switzerland following the borders valid since 1848.

Usage

PlotCH(col = NA, main = "", col.vf = NA,
       border = "grey", border.vf = NA, lwd = 1,
       tmtxt = TRUE, add = FALSE, ...)

Value

A list containing x and y component of the centroid of the plotted spatial unit.

Arguments

col

vector of colors, defining the colors of the cantons.
Note: NAs are recoded as white.

main

main title in the plot.

col.vf

defines a color for the vegetational area ("Vegetationsflaeche").
If NA only the total area is used.

border

color of map border. Default is "grey".

border.vf

color of borders for the vegetational area. Default is "grey".

lwd

linewidth for the border. Default is par("lwd").

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.

Author

Andri Signorell <andri@signorell.net>

Details

The list of all cantons and their ids is given by d.bfsrg:
cantons <- unique(d.bfsrg[,c("kt_c", "kt_x", "kt_bez_x")])

See Also

PlotGreg, PlotKant, PlotBezk, PlotPolg, d.bfsrg

Examples

Run this code
try( {

PlotCH(col="lightgrey")
AddLakes()

# use the result to add a semitransparent label
xy <- PlotCH(col.vf = "grey90", col="grey75", border="grey50", border.vf = NA)
AddLakes()
AddRivers()
PlotCH(add=TRUE, col=NA)
BoxedText(x=xy$x, y=xy$y, labels = "Visit\n Switzerland", cex=3, txt.col = "grey40",
          col=SetAlpha("white", 0.6), border=NA, ypad=0.5)


# wawing flag ...
PlotCH(col="red", main="Switzerland")
sw <- 15000;
xc <- 2671975;
yc <- 1200600;

ccol <- rgb(1,1,1,0.85)
rect(xleft=xc-sw, ytop=yc-sw, xright=xc+sw, ybottom=yc+sw, col=ccol, border=NA)
rect(xleft=(xc-2*sw)-sw, ytop=yc-sw, xright=(xc-2*sw)+sw, ybottom=yc+sw, col=ccol, border=NA)
rect(xleft=(xc+2*sw)-sw, ytop=yc-sw, xright=(xc+2*sw)+sw, ybottom=yc+sw, col=ccol, border=NA)
rect(xleft=xc-sw, ytop=(yc-2*sw)-sw, xright=xc+sw, ybottom=(yc-2*sw)+sw, col=ccol, border=NA)
rect(xleft=xc-sw, ytop=(yc+2*sw)-sw, xright=xc+sw, ybottom=(yc+2*sw)+sw, col=ccol, border=NA)

# using panel.first ensures that the borders are not hidden by waters
PlotCH(col=NA, lwd=2, panel.first=AddLakes())

})

Run the code above in your browser using DataLab