Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 1.29 KB

README.md

File metadata and controls

34 lines (22 loc) · 1.29 KB

rGridMap

An R Package for tessellated hexagon grid maps of US states in R + ggplot2

Inspired by the blog post by Danny DeBelius of the NPR visuals team and the general 2015 tweet storm and Flowing Data covereage of grid maps.

It is easy to use!

Installation

Use install_github from the devtools package

library(devtools)
install_github('arvi1000/rGridMap')

A toy example

# a data.frame of states with random categorical value
my_dat <- data.frame(state.abb = c(state.abb, 'DC'), # don't forget DC!
                     value=sample(LETTERS[1:5], 51, replace=T))

# build grid map plot
my_grid_map <- plotGridMap(my_dat, fill_var = 'value')

# and you can manipulate the resultant object as you would any ggplot object
my_grid_map +
 scale_fill_brewer(type='qual') +
 labs(title = 'States by Category', fill = 'Category')

An example with real data

(See the examples folder for code)