hex_usa: Creates hexagonal tile map for the states of USA.

Description Usage Arguments Value Examples

Description

Creates hexagonal tile map for the states of USA.

Usage

1
2
hex_usa(d = 0.95, center = FALSE, style = "NPR", size = 1,
  long_offset = 0, lat_offset = 0, exclude = character())

Arguments

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.

Value

The available styles for this functions are "NPR".

Examples

 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)

EmilHvitfeldt/tilemapr documentation built on May 20, 2019, 5:09 p.m.