Closed Robinlovelace closed 9 years ago
Thanks for reporting this! Actually, it's not a bug. Aesthetics, like lwd, may take a vector, but if so, each value will correspond to a facet. Like qtm(World, fill=c("red", "blue"))
does. The key is to assign the values to a shape variable.
This will produce the kind of map you want:
osm_tiles <- read_osm(bb(rnet, ext = 1.05))
rnet$lwd <- rnet$All / mean(rnet$All)
tm_shape(osm_tiles) +
tm_raster(saturation = .25) +
tm_shape(rnet) +
tm_lines(lwd = "lwd", scale = 5, legend.lwd.show = FALSE) +
tm_shape(cents) +
tm_bubbles()
Many thanks for this clear, detailed and reproducible response. Your code has been used directly in the README and it's looking great: https://github.com/Robinlovelace/stplanr
Making the facetting depend on the data source is an elegant solution that makes sense - I'll try to add some documentation to tmap on this if I get a chance.
Reproducible example:
Run the code on this page: https://github.com/Robinlovelace/stplanr
The this is the result of the following code:
Not sure what's going on here - guess I've mis-understood the tmap syntax.
What I want is a plot like this but with the osm background: