Description Usage Arguments Note Author(s) See Also Examples
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.
1 |
x |
The output object from |
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 |
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 |
... |
additional arguments to be passed to the low level plotting functions. |
The shape files for this command are from the Swiss government and can be downloaded here: http://www.bfs.admin.ch/bfs/portal/de/index/dienstleistungen/geostat/datenbeschreibung/generalisierte_gemeindegrenzen.html. 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.
Lucas Leemann
1 2 3 4 5 6 7 8 9 10 | # 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")
## 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))
## no labels
## Not run: map.MrP(fake.pref, main="This Map Shows Random Data", legend.text1="Support for Anything", labels=FALSE)
## 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"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.