# NOT RUN {
# }
# NOT RUN {
# removed for R CMD check speed
map <- get_map(
location = c(-77.0425, 38.8925), # painfully picked by hand
source = "google", zoom = 14, maptype = "satellite"
)
ggmap(map)
(legs_df <- route(
"the white house, dc",
"lincoln memorial washington dc",
alternatives = TRUE
))
ggplot(data = legs_df) +
geom_leg(aes(
x = startLon, xend = endLon,
y = startLat, yend = endLat
)) +
coord_map()
ggplot(data = legs_df) +
geom_leg(aes(
x = startLon, xend = endLon,
y = startLat, yend = endLat,
color = route
)) +
coord_map()
ggmap(map) +
geom_leg(
aes(
x = startLon, xend = endLon,
y = startLat, yend = endLat
),
data = legs_df, color = "red"
)
# adding a color aesthetic errors because of a base-layer problem
# ggmap(map) +
# geom_leg(
# aes(
# x = startLon, xend = endLon,
# y = startLat, yend = endLat,
# color = route
# )
# )
# this is probably the easiest hack to fix it
ggplot(data = legs_df) +
inset_ggmap(map) +
geom_leg(
aes(
x = startLon, xend = endLon,
y = startLat, yend = endLat,
color = route
),
data = legs_df
) +
coord_map()
# }
# NOT RUN {
# }
# NOT RUN {
# removed for R CMD check speed
map <- get_map(
location = c(-77.0425, 38.8925), # painfully picked by hand
source = "google", zoom = 14, maptype = "satellite"
)
ggmap(map)
(legs_df <- route(
"the white house, dc",
"lincoln memorial washington dc",
alternatives = TRUE
))
ggplot(data = legs_df) +
geom_leg(aes(
x = startLon, xend = endLon,
y = startLat, yend = endLat
)) +
coord_map()
ggplot(data = legs_df) +
geom_leg(aes(
x = startLon, xend = endLon,
y = startLat, yend = endLat,
color = route
)) +
coord_map()
ggmap(map) +
geom_leg(
aes(
x = startLon, xend = endLon,
y = startLat, yend = endLat
),
data = legs_df, color = "red"
)
# adding a color aesthetic errors because of a base-layer problem
# ggmap(map) +
# geom_leg(
# aes(
# x = startLon, xend = endLon,
# y = startLat, yend = endLat,
# color = route
# )
# )
# this is probably the easiest hack to fix it
ggplot(data = legs_df) +
inset_ggmap(map) +
geom_leg(
aes(
x = startLon, xend = endLon,
y = startLat, yend = endLat,
color = route
),
data = legs_df
) +
coord_map()
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab