Description Usage Arguments Details See Also Examples
This is ggplot2's segment with rounded ends. It's mainly included in ggmap for historical reasons.
Single line segments with rounded ends
1 2 3 4 5 6 7 | geom_leg(mapping = NULL, data = NULL, stat = "identity",
position = "identity", arrow = NULL, lineend = "round", na.rm = FALSE,
show.legend = NA, inherit.aes = TRUE, ...)
geom_leg(mapping = NULL, data = NULL, stat = "identity",
position = "identity", arrow = NULL, lineend = "round", na.rm = FALSE,
show.legend = NA, inherit.aes = TRUE, ...)
|
mapping |
mapping |
data |
data |
stat |
stat |
position |
position |
arrow |
arrow |
lineend |
Line end style (round, butt, square) |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
... |
... |
only intended for use in ggmaps package. only designed for mercator projection.
only intended for use in ggmaps package. only designed for mercator projection.
geom_segment in ggplot2, inspired by
http://spatialanalysis.co.uk/2012/02/great-maps-ggplot2/,
route
geom_segment in ggplot2, inspired by
http://spatialanalysis.co.uk/2012/02/great-maps-ggplot2/,
route
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | ## 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()
## End(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()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.