Link Search Menu Expand Document

Answer to exercise

R Code

tm_shape(vancouver_boundaries) +
  tm_polygons(col="name", border.col = "white", title="neighbourhood", palette = "Pastel1") +
  tm_shape(schools) + tm_dots(col="red", size=.1, shape=18) +
  tm_shape(libraries) + tm_dots(col="yellow", size=.1, shape=16) +
  tm_shape(community_centres) + tm_dots(col="blue", size=.1, shape=15) +
  tm_shape(disability_parkings) + tm_dots(col="black", size=.1, shape=17) +
  tm_legend(outside=TRUE) +
  tm_add_legend(type = "symbol", 
                shape=c(18, 16, 15, 17), 
                labels=c("Schools", "Libraries", "Community Centres", "Disability Parking"),
                col=c("red", "yellow", "blue", "black")) +  
tm_layout(main.title="City of Vancouver", main.title.position = "left")

Output