Learn R Programming

swissMrP (version 0.62)

map.MrP: Map for MrP Estimates

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

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.

See Also

zip1 swissMrP

Examples

Run this code
# NOT RUN {
# Vanilla example
fake.pref <- runif(26)
class(fake.pref) <- "swissMrP"
# }
# NOT RUN {
map.MrP(fake.pref, main="This Map Shows Random Data", 
        legend.text1="Support for Anything")
        
# }
# NOT RUN {
## changing intervals
# }
# NOT RUN {
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))
        
# }
# NOT RUN {
## no labels
# }
# NOT RUN {
map.MrP(fake.pref, main="This Map Shows Random Data", 
        legend.text1="Support for Anything", labels=FALSE)
        
# }
# NOT RUN {
## specify different colors and less groups
# }
# NOT RUN {
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"))
        
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab