I have a dataframe like the following:
country <- c('US', 'CA','TW')
city <- c('Atlanta','Halifax','Taipei')
lat <- c(33.8004, 44.6500, 25.0392 )
lon <- c( -84.3865,-63.6000,121.5250 )
data <- data_frame(country,city, lat, lon)
> data
# A tibble: 3 × 4
country city lat lon
<chr> <chr> <dbl> <dbl>
1 US Atlanta 33.8004 -84.3865
2 CA Halifax 44.6500 -63.6000
3 TW Taipei 25.0392 121.5250
Think of this data as each observations is a mobile call from a city around the world (there could be multiple call from the same city of course).
There are two things I would like to do with this data.
Simplest map. I would simply like to (nicely) plot these calls as a many dots on a global map. So dots may of course be overlaid (with some alpha blending)
Nicer map. First, count how many observations per cities (easy to do with
dplyr
), and then create a map where polygons are cities. That way, each city has a color according to the number of calls in that city. Ideally I would like to get something like
but for cities on a global map.
Problem is: I dont know where to get the right maps for this and to complicate the matter I can only download the maps manually (not via get_map
for instance)
Any ideas how to get these two simple maps?
annotation_raster(Downloaded_Image, xmin= -160, xmax= 160, ymin= 80, ymax= -80, interpolate = TRUE)
to use it as backdrop in ggplot2.