I have managed to plot a map of London using tmap in R:
library(sf)
library(tmap)
library(dplyr)
library(OpenStreetMap)
qtm("London")
tmap_mode("plot")
tm_shape(lnd) +
tm_polygons(alpha = 0.7, legend.show = FALSE) +
tm_basemap(server = c('OpenStreetMap'))
But now I want to overlay some different sized bubbles on top of this map to show the number of tweets that mention a particular train station. Here is an example of what I want the bubbles to look like:
My train station data is like this with the lat/long for each of the stations and the volume of tweets: https://filebin.net/emjnete8pf0ulxpe
When I load the stations data, I know I am meant to convert to an sf object (see below):
stations <- read.csv("Stations_example.csv", header = TRUE, stringsAsFactors = FALSE)
stations1 <- st_as_sf(stations, coords = c('Long', 'Lat'), crs=4326)
After this I get stuck - I am not sure how to get this information on the map in the way I want it.
Can anyone help? I am not wedded to using tmap
. If there is a solution using another R package, I am happy to give that a go (although, I cannot use ggmap
due to having to sign up with a credit card).
UPDATE 18/12/2019:
Thanks to Spacedman for his suggestion. It didn't initially work when I kept the tm_polygons
bit in. This seemed to do the trick:
qtm("London")
tmap_mode("view")
tm_shape(stations1)+
tm_bubbles(col = "red", size= "Volume", scale = .5) +
tm_basemap(server = c('OpenStreetMap'))