hafen
geofacet
R

R package for geographical faceting with ggplot2

Last updated Jul 1, 2026
352
Stars
48
Forks
144
Issues
+1
Stars/day
Attention Score
85
Language breakdown
R 100.0%
Files click to expand
README

R-CMD-check Codecov test coverage CRAN CRAN Downloads

geofacet

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.

Install

install.packages("geofacet")

or from github:

remotes::install_github("hafen/geofacet")

Example

See here for the package vignette.

Barchart of state rankings in various categories:

library(ggplot2)

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

us_categories

Unemployment rate time series for each state:

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

us_unemp

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

ggplot(eugdp, aes(year, gdppc)) +
  geom_line(color = "steelblue") +
  facetgeo(~ name, grid = "eugrid1", scales = "free_y") +
  scalexcontinuous(labels = function(x) paste0("'", substr(x, 3, 4))) +
  ylab("GDP Per Capita in Relation to EU Index (100)") +
  theme_bw()

eu_gdp

🔗 More in this category

© 2026 GitRepoTrend · hafen/geofacet · Updated daily from GitHub