Description Usage Arguments Value Examples
Creates hexagonal tile map for the states of USA.
1 2 |
d |
Numeric. Number between 0 and 1. Procentwise Diameter (length from center to corner) of the tiles. |
center |
Logical. When TRUE returns the center coordinates of the tile map. |
style |
Character. Selets the layout style of the tile map. |
size |
Numeric. Size of the tiles. |
long_offset |
Numeric. Value to offset the long output. |
lat_offset |
Numeric. Value to offset the lat output. |
exclude |
Character. Vector of state names which should be excluded from the output. Matched with lowercase full state names. |
The available styles for this functions are "NPR".
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
library(ggplot2)
crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests)
states_map <- hex_usa()
ggplot(crimes, aes(map_id = state)) +
geom_map(aes(fill = Murder), map = states_map) +
expand_limits(x = states_map$long, y = states_map$lat)
states_map <- hex_usa(d = 0.5)
ggplot(crimes, aes(map_id = state)) +
geom_map(aes(fill = Murder), map = states_map) +
expand_limits(x = states_map$long, y = states_map$lat) +
geom_text(data = hex_usa(d = 0.5, center = TRUE),
aes(x = long, y = lat, label = states_abb),
inherit.aes = FALSE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.