fifty_states: Fifty U.S. States and Washington D.C. with Alaska and Hawaii...

Description Usage Format Details Source See Also Examples

Description

Map data to plot the entire United States by transforming Alaska and Hawaii to appear as insets nearby the continental states.

Usage

1

Format

A data frame with 13694 rows and 7 variables:

long,lat

Numeric, latitude and longitude coordinates for shapes.

order

Integer, drawing order of shapes.

hole

Logical, whether the shape represents a negation.

piece

Factor, groupings of shapes.

id

Character, lower case state names mapped to plot data via the map_id aesthetic in geom_map.

group

Factor, groupings of shapes.

Details

The fifty_states data frame is provided in the format expected by the map argument to geom_map. Border boxes for the inset states can be included by adding fifty_states_inset_boxes to the plot.

Source

Original shapefile provided by Charlie Fitzpatrick via ArcGIS. Transformations based on code from Barry Rowlingson on StackOverflow http://stackoverflow.com/a/13767984.

See Also

fifty_states_inset_boxes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
if(require("mapproj") && require("ggplot2")) {
  crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests)
  p <- ggplot(crimes, aes(fill = UrbanPop, map_id = state)) +
    geom_map(map = fifty_states) +
    expand_limits(x = fifty_states$long, y = fifty_states$lat) +
    coord_map()
 p
 # Add bounding boxes for Alaska and Hawaii
 p + fifty_states_inset_boxes()
}

fiftystater documentation built on May 29, 2017, 11:50 a.m.