Using CartoDB to visualize the relationship between private prisons and incarceration rates

7 minute read

The last post I wrote about CartoDB used the CartoDB API and Leaflet.js to produce a hover tooltip map of census data. Looking back, while it's quite useful to learn CartoDB's API, it's now possible to achieve those same visual cues and interactivity without spending time wading through complex, undocumented JavaScript. You can now do everything I did here using little more than CartoDB's frontend CMS.

So, when I ran across this database of all prisons and correctional facilities in the nation on Enigma.io, I used the dataset to put together this visualization displaying all 137 private prisons and correctional facilities – all of which are  owned entirely by just five different private enterprises – and then added a simple chloropleth layer displaying incarceration rates by state underneath.

Can't see what's going on too well at the resolution below? Here's a standalone package:

Click here to view the project live


(yes, it's responsive!)



This visualization is a case in which deeper statistical analysis and consideration of multiple variables would've bolstered the possible argument that private prisons lead to higher incarceration rates, if such a claim is true, that is (i.e., determining a statistically significant correlation between number of inmates in each state with the number of private prisons or correctional facilities located there).

Such a data-driven study of the private prison industry conducted by U.C. Berkely Ph.D. student Chris Petrella concluded that blacks are disproportionately incarcerated in private prisons as opposed to public jails.

A similar methodology could be applied to private prison populations in general, as many private prisons are required by state or local law to have a minimum quota of around 90 to 95 percent occupancy to keep their government contracts. It would be interesting, too, to visualize that data in a manner more easily accesible to the average user than an academic research journal.

Tools I would've used before new CartoDB:

  • Batch geocode by findlatitudelongitude to geocode the address data into lat/long coordinates.
  • ColorBrewer2.org to find equidistant color scales.
  • Locating .shp, .kml or .geojson polygons for the U.S. states.
  • Excel to merge tables and bind geographic with numeric data.
  • A custom JavaScript powered control panel – like the one I used here – to categorize the locations by owner.
  • Leaflet.js
  • MapBox
  • Who knows?

All of those tasks are automated in the new CartoDB!

Leave a Comment