geofacet v0.2.0

0

Monthly downloads

0th

Percentile

'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.

Readme

Build Status Coverage Status 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() +
  facet_geo(~ state, grid = "us_state_grid2") +
  scale_x_continuous(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(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)") +
  theme_bw()

eu_gdp

Functions in geofacet

Name Description
eu_imm eu_imm
india_pop india_pop
get_ne_data Get rnaturalearth data
grid_auto Generate a grid automatically from a country/continent name or a SpatialPolygonsDataFrame or `sf` polygons
state_ranks state_ranks
grid_design Interactively design a grid
grid_preview Plot a preview of a grid
london_afford london_afford
state_unemp state_unemp
grid_submit Submit a grid to be included in the package
grids Geo Grids
print.facet_geo Print geofaceted ggplot2 object
nhs_scot_dental nhs_scot_dental
plot.facet_geo Plot geofaceted ggplot2 object
sa_pop_dens sa_pop_dens
auto_states auto_states
geofacet geofacet
facet_geo Arrange a sequence of geographical panels into a grid that preserves some geographical orientation
get_geofacet_grob Perform post-processing on a facet_geo ggplot object
get_grid_names Get a list of valid grid names
attach_spdf Attach a SpatialPolygonsDataFrame object to a grid
eu_gdp eu_gdp
aus_pop aus_pop
election election
No Results!

Vignettes of geofacet

Name
geofacet.Rmd
No Results!

Last month downloads

Details

License MIT + file LICENSE
Encoding UTF-8
LazyData true
URL https://github.com/hafen/geofacet
BugReports https://github.com/hafen/geofacet/issues
RoxygenNote 7.1.0
VignetteBuilder knitr
NeedsCompilation no
Packaged 2020-05-25 22:48:34 UTC; hafen
Repository CRAN
Date/Publication 2020-05-26 11:00:15 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/geofacet)](http://www.rdocumentation.org/packages/geofacet)