Description Usage Details Value Examples
Border boxes for the insets of Alaska and Hawaii in
fifty_states
can be added to the map with this function.
1 |
Adding the result of this function to your ggplot will add a layer with
border boxes to highlight the insets. It draws data from the package data
object
fifty_states_inset_boxes_data
and creates a layer to plot the borders
with annotate
.
A ggplot2 layer object with path data to draw the inset border boxes
1 2 3 4 5 6 7 | if(require("mapproj") && require("ggplot2")) {
crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests)
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() + fifty_states_inset_boxes()
}
|
Loading required package: mapproj
Loading required package: maps
Loading required package: ggplot2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.