Subscribe to DSC Newsletter

Choropleth in D3.js and Pandas (iPython Notebook)

There have been various attempts to integrate the D3.js visualization framework into iPython Notebook, in order to provide more visualization options than available with the standard Matplotlib. In my blog post today, I take one of the better integration attempts out there, port it from Windows to the Mac, and demonstrate:

1. Passing a Pandas Dataframe from iPython Notebook into the D3.js Javascript

2. Generating geo color maps in D3.js (not a built-in capability) by pulling geo shape data from Wikipedia on the fly.

3. The resulting visualization is inline in the Notebook (not a floating frame or window) and printable into PDF (with the limitation of max one visualization per PDF, and needing to use Firefox to do so).

First-class support for D3.js won't be coming until iPython Notebook 2.0, and 1.0 isn't even out yet after 10 years of development. In the meantime, it is necessary to use work-arounds such as the ones described in my blog post.

http://technicaltidbit.blogspot.com/2013/07/choropleth-in-d3js-and-...

Views: 5533

Comment

You need to be a member of Data Science Central to add comments!

Join Data Science Central

Videos

  • Add Videos
  • View All

© 2019   Data Science Central ®   Powered by

Badges  |  Report an Issue  |  Privacy Policy  |  Terms of Service