How to add a legend to a plot using qtm in R

276 views Asked by At

I am using tmap package and am using its functionality to get a map of area I'm interested in

library(tmap)
qtm("London")

Then I have SpatialLinesDataFrame containing data on number of trips so I want to display those using number ot trips as width, i.e.

qtm("London")+
qtm(l, lines.lwd=l$Trips/10)+
tmap_options(limits=c(facets.view)=1))

But I can't find a way to display a legend

A way to reproduce quickly what I am doing is

library(stplanr)
library(tmap)
data("flow", package = "stplanr")
data("cents", package = "stplanr")
as.data.frame(cents[1:3, -c(3,4)])
l <- od2line(flow = flow, zones = cents)
qtm("Leeds")+
qtm(l, lines.lwd=l$All/10)+
tmap_options(limits=c(facets.view)=1))

And I am trying to add a legend which would say that line width is based on trip number.

0

There are 0 answers