Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arvi1000/rGridMap
R Package for tessellated hexagon grid maps of US states in R + ggplot2
https://github.com/arvi1000/rGridMap
Last synced: about 2 months ago
JSON representation
R Package for tessellated hexagon grid maps of US states in R + ggplot2
- Host: GitHub
- URL: https://github.com/arvi1000/rGridMap
- Owner: arvi1000
- Created: 2015-10-09T19:04:44.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-10-11T03:55:17.000Z (almost 5 years ago)
- Last Synced: 2024-05-21T02:55:33.950Z (4 months ago)
- Language: R
- Size: 1.35 MB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rGridMap
An R Package for tessellated hexagon grid maps of US states in R + ggplot2Inspired by the [blog post](http://blog.apps.npr.org/2015/05/11/hex-tile-maps.html) by Danny DeBelius of the NPR visuals team and the general 2015 tweet storm and [Flowing Data covereage](https://flowingdata.com/2015/05/12/the-great-grid-map-debate-of-2015/) 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')
![](example/rGridMap_example.png)### An example with real data
(See the [examples folder](example/senate_debut_example.R) for code)
![](example/senate_debut.png)### Dark theme example
Here's an example where we set the state text labels and hex outlines to white (using parameters of `plotGridMap()`), make the plot background black (using standard ggplot parameters to `theme()`), and apply a viridis color scale (using `scale_fill_viridis_c()`, from ggplot).
(See the [examples folder](example/dark_theme_example.R) for code)
![](example/dark_theme.png)