Plotting customised maps with RSwissMaps"

Plotting municipality-level maps

Data collection (with random sample data)

library(RSwissMaps, quietly = T)
dt <- mun.template(year = 2016)

for(i in 1:nrow(dt)){

  dt$values[i] <- sample(c(400:600), 1)/1000

}

Plotting map of sample data

mun.plot(dt$bfs_nr, dt$values, 2016)

Plotting a tailor-made map of sample data

mun.plot(dt$bfs_nr, dt$values, 2016, 
         cantons = c("AG", "ZH"), 
         lakes = c("Hallwilersee", "Greifensee", "Zürichsee"), 
         title = "title goes here", 
         subtitle = "subtitle goes here", 
         caption = "caption goes here", 
         legend_title = "Percentage")

Plotting district-level maps

Data collection (with random sample data)

dt2 <- dis.template(year = 2016)

for(i in 1:nrow(dt2)){

  dt2$values[i] <- sample(c(400:600), 1)/1000

}

Plotting map of sample data

dis.plot(dt2$bfs_nr, dt2$values, 2016)

Plotting a tailor-made map of sample data

dis.plot(dt2$bfs_nr, dt2$values, 2016, 
         cantons = c("AG", "BE", "SO"), 
         lakes = c("Hallwilersee", "Bielersee", "Brienzersee", "Thunersee"), 
         title = "title goes here", 
         subtitle = "subtitle goes here", 
         caption = "caption goes here", 
         legend_title = "Percentage")

Plotting canton-level maps

Data collection (with random sample data)

dt3 <- can.template(year = 2016)

for(i in 1:nrow(dt3)){

  dt3$values[i] <- sample(c(400:600), 1)/1000

}

Plotting map of sample data

can.plot(dt3$bfs_nr, dt3$values, 2016)

Plotting a tailor-made map of sample data

can.plot(dt3$bfs_nr, dt3$values, 2016, 
         title = "title goes here", 
         subtitle = "subtitle goes here", 
         caption = "caption goes here", 
         legend_title = "Percentage")


Try the RSwissMaps package in your browser

Any scripts or data that you put into this service are public.

RSwissMaps documentation built on June 10, 2019, 1:02 a.m.