State Bin

This is an alpha version of tool to create interactive state bin maps. It has an R API as well as a javascript API.


You can install rcstatebin from github.

install_github(c('ramnathv/htmlwidgets', 'ramnathv/rcstatebin'))


Let us start by recreating some analysis done by on where states get their taxes from.

statebin(data = taxdata,
  x = "state",
  y = "share",
  facet = "description",
  heading =  "<b>Where do your state's taxes come from?</b>",
  footer = "<small>Source: Census <a href=''>(Data)</a>",
  colors = RColorBrewer::brewer.pal(5, 'PuRd'),
  control = 'dropdown'

You can also use a formula interface to create a statebin chart.

statebin(taxdata, share ~ state | description, control = 'dropdown')

Javascript API

I built d3statebin using a modular approach following the reusable chart guidelines outlined by Mike Bostock

mystatemap = statemap()


Thanks are due to all these folks below, for building great components were used to create d3statebin

  1. Mike Bostock for D3.js
  2. Elijah Meeks for d3.svg.legend
  3. Gregor Aisch for d3-jetpack
  4. Justin Palmer for d3-tip
  5. Bob Rudis for statebins
  6. Kenton Russell for a lot of things.