1

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.

  • have you looked at `tm_add_legend()`? Maybe you can provide sample data? Just the top 3-4 lines using `dput(head(bew_profil2, 4))`. Will have a look at it tomorrow then. – Humpelstielzchen Feb 27 '19 at 14:36
  • @Humpelstielzchen I have now edited and added code so that everyone can reproduce what I am doing, couldn't find a way to use `tm_add_legend` as I have no shape, i.e. `tm_shape` which I can't find a way to add as I am using OSM map as background – Kacper Rossa Feb 28 '19 at 08:43

0 Answers0