'ggplot2' Faceting Utilities for Geographical Data

Provides geofaceting functionality for 'ggplot2'. Geofaceting arranges a sequence of plots of data for different geographical entities into a grid that preserves some of the geographical orientation.

Build Status Coverage Status CRAN CRAN Downloads

This R package provides geofaceting functionality for ggplot2. Geofaceting arranges a sequence of plots of data for different geographical entities into a grid that strives to preserve some of the original geographical orientation of the entities. It's easiest to describe with examples. See below.


# or from github:
# devtools::install_github("hafen/geofacet")


See here for the package vignette.

Barchart of state rankings in various categories:

ggplot(state_ranks, aes(variable, rank, fill = variable)) +
  geom_col() +
  coord_flip() +
  facet_geo(~ state) +


Unemployment rate time series for each state:

ggplot(state_unemp, aes(year, rate)) +
  geom_line() +
  facet_geo(~ state, grid = "us_state_grid2") +
  scale_x_continuous(labels = function(x) paste0("'", substr(x, 3, 4))) +
  ylab("Unemployment Rate (%)")


GDP per capita in relation to EU index (100) for each country in the European Union:

ggplot(eu_gdp, aes(year, gdp_pc)) +
  geom_line(color = "steelblue") +
  facet_geo(~ name, grid = "eu_grid1", scales = "free_y") +
  scale_x_continuous(labels = function(x) paste0("'", substr(x, 3, 4))) +
  ylab("GDP Per Capita in Relation to EU Index (100)") +



Version 0.1

  • Add new grids (0.1.9)
  • Integration with geogrid package with new function grid_auto() (0.1.9)
  • Fix issue with plotting in R Markdown and ggsave (0.1.9)
  • Search for data in layers as well as global data for facet setup (0.1.9)
  • Fix bug in filtering gtable with large grids (0.1.8)
  • Several new grids (0.1.8)
  • Several new grids (0.1.7)
  • Add plot method in addition to print method for facet_geo objects (0.1.7)
  • 17 new grids
  • Fix vignette redirect

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.2.0 by Ryan Hafen, a year ago


Report a bug at https://github.com/hafen/geofacet/issues

Browse source code at https://github.com/cran/geofacet

Authors: Ryan Hafen [aut, cre] , Barret Schloerke [ctb]

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports ggplot2, gtable, graphics, rnaturalearth, sp, sf, ggrepel, imguR, gridExtra, geogrid, methods

Suggests testthat, covr, lintr, knitr, rmarkdown

Imported by bbsBayes.

Suggested by arcos, geofi.

See at CRAN