Billy Fung

Interactive plots with D3.js

Javascript fun

Billy Fung / 2015-11-26


D3.js interactive posts

A picture is worth a thousand words right? So a moving picture must be worth even more! Since I’ve been playing around with R and data science-y stuff I figured it would be worth it to play around with interactive graphs. They seem to be all the rage these days, with many media sites using them and I also think they’re pretty great to show off lots of data at once. It’d be like showing an embedded pivot table (I bet this exists). My website is made with Middleman, so this is a markdown blog post with d3.js.

Here’s an iframe (not very nice):

<iframe src="http://bl.ocks.org/mbostock/raw/4061502/0a200ddf998aa75dfdb1ff32e16b680a15e5cb01/" 
width="600" height="400" marginwidth="0" marginheight="0" scrolling="no"></iframe>

And here is an animated graph done using d3.js:

All in all, it’s pretty neat to make these things and I will probably use more them to show off different things in the future. To do: figure out centering figures on my posts.