0

I have created a map of london showing a crime figures. As you can see from my image below - my legend is in a awkward place - i'd prefer it to be on the bottom left or right? anyone know how I could possibly do this. My code that I have created the map with is below.

Also how would i create a title for the map - I have already created the legend title.

map and legend

enter image description here

qtm(brgh, fill = "Theft15", fill.title="Number of recorded thefts")
Community
  • 1
  • 1
bootz123
  • 11
  • 2
  • 4

1 Answers1

3

Since I do not have your data, I decided to use data from the tmap package for the following demonstration. The key point is to use tm_legend(). If you look into the current CRAN manual, you can find more information in the tm_layout() section. You can specify a position of legend using legend.position in tm_legend(). For main title, you can use main.title and main.title.position in the function.

library(tmap)

data(World, rivers, metro)

qtm(shp = World, fill = "economy", format = "World", style = "col_blind") +
tm_legend(legend.position = c("left", "top"),
          main.title = "My title",
          main.title.position = "right")

enter image description here

qtm(shp = World, fill = "economy", format = "World", style = "col_blind") +
tm_legend(legend.position = c("left", "bottom"),
          main.title = "My title",
          main.title.position = "right")

enter image description here

jazzurro
  • 23,179
  • 35
  • 66
  • 76