Skip to content

Instantly share code, notes, and snippets.

@rafapereirabr
Last active August 14, 2016 21:48
Show Gist options
  • Save rafapereirabr/eff077bc30e6e23b889bef62d709530a to your computer and use it in GitHub Desktop.
Save rafapereirabr/eff077bc30e6e23b889bef62d709530a to your computer and use it in GitHub Desktop.
library(data.table)
library(ggmap)
# load data. Obs: The file used in this example does not allow to create flow maps
df <- fread("your_data.csv)
# Get Map background
map <- get_map(location = c(lon = -43.45967, lat = -22.92728),
zoom = 10, source = "stamen", maptype = "toner-background")
# plot
ggmap(map) +
geom_path(data = df, aes(x= longitude, y= latitude, color= route_id ), alpha=0.3) +
coord_map(xlim = c(-43.828854, -43.117908),ylim = c(-23.091709, -22.760493)) +
theme(legend.position="none")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment