Plotting customised maps with RSwissMaps

David Zumbach

2017-10-02

Plotting municipality-level maps

Data collection (with random sample data)

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")