map.MrP: Map for MrP Estimates

Description Usage Arguments Note Author(s) See Also Examples

Description

This is a simple wrapper that reads in shape files and creates an ordinary map. The displayed map will show the intensity of support for each canton.

Usage

1
map.MrP(x, colors.m, threshold, main, labels = TRUE, legend.text1, legend.text2, ...)

Arguments

x

The output object from swissMrP whether it is a vector or a matrix (the latter if simulations were ran in swissMrP).

colors.m

Vector of colors to be used in increasing order. If the user does not supply any colors, the plot will use a default option (from red to green).

threshold

Vector. By default the map breaks support in ten equal-sized intervals. If one supplies colors, the support will be broken into length(colors.m) equal intervals. If the user wishes to change the intervals this is done by supplying a vector with interval boundaries starting with 0. For n intervals one needs n+1 bondaries.

main

User may specify a title for the plot.

labels

Logical. User may specify whether labels should be written automatically or if they should be omitted.

legend.text1

User may specify a legend, e.g. Support Smoking Ban to declare what the colors indicate.

legend.text2

Like legend.text1, offers a second line.

...

additional arguments to be passed to the low level plotting functions.

Note

The shape files for this command are from the Swiss government (Swiss Federal Statistics Office, 2013.). While this function only needs the cantonal boundaries one can also download the shape files for municipality boundaries at the above mentioned URL. The actual mapping is done with the plot command based on elements from the maptools package.

Author(s)

Lucas Leemann

See Also

zip1 swissMrP

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Vanilla example
fake.pref <- runif(26)
class(fake.pref) <- "swissMrP"

map.MrP(fake.pref, main="This Map Shows Random Data", 
        legend.text1="Support for Anything")
        
## changing intervals

map.MrP(fake.pref, 
        threshold=c(0,0.3,0.45,0.48,0.49,0.5,0.51,0.52,0.55,0.7,1))
        
## no labels

map.MrP(fake.pref, main="This Map Shows Random Data", 
        legend.text1="Support for Anything", labels=FALSE)
        
## specify different colors and less groups

map.MrP(fake.pref, main="This Map Shows Random Data", 
        legend.text1="Support for Anything", 
        colors.m=c("skyblue","skyblue1","skyblue2","skyblue3",
        "slateblue","slateblue1","slateblue2"))
        

swissMrP documentation built on May 2, 2019, 11:12 a.m.