geofacet v0.1.9

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:
# devtools::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
attach_spdf Attach a SpatialPolygonsDataFrame object to a grid
eu_gdp eu_gdp
get_ne_data Get rnaturalearth data
aus_pop aus_pop
get_grid_names Get a list of valid grid names
plot.facet_geo Plot geofaceted ggplot2 object
state_ranks state_ranks
sa_pop_dens sa_pop_dens
facet_geo Arrange a sequence of geographical panels into a grid that preserves some geographical orientation
state_unemp state_unemp
grid_submit Submit a grid to be included in the package
print.facet_geo Print geofaceted ggplot2 object
geofacet geofacet
london_afford london_afford
nhs_scot_dental nhs_scot_dental
grids Geo Grids
grid_preview Plot a preview of a grid
grid_auto Generate a grid automatically from a country/continent name or a SpatialPolygonsDataFrame
grid_design Interactively design a grid
+.gg Add method for gg / facet_geo
india_pop india_pop
auto_states auto_states
eu_imm eu_imm
election election
No Results!

Vignettes of geofacet

Name
docs.Rmd
rd.Rmd
rd_index.yaml
No Results!

Last month downloads

Details

License MIT + file LICENSE
Encoding UTF-8
LazyData true
RoxygenNote 6.0.1
VignetteBuilder knitr, packagedocs
NeedsCompilation no
Packaged 2018-03-29 21:42:19 UTC; hafen
Repository CRAN
Date/Publication 2018-03-29 22:01:51 UTC

Include our badge in your README

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