Re:XKCD-style charts with D3
by jamesaguilar on Thursday October 18, 2012 @08:11PM
(#4671697)
If I'm honest, the most impressive thing about this is how much less concise this is than the mathematica version that came out earlier. I wonder if the difference is more a matter of the library quality or the syntax.
Re:XKCD-style charts with D3
by wladimir on Friday October 19, 2012 @02:09AM
(#4672469)
D3js is pretty verbose, but what you get is full control. Most charting libraries allow only a limited amount of configurability, which is neat if you just need to plot a basic chart quickly, but makes them awful if you want to make novel (or at least, more uncommon) kinds of visualisations or make non-standard changes to existing ones.
Re:XKCD-style charts with D3
by primitur on Friday October 19, 2012 @04:19PM
(#4675233)
The best thing about this is that it doesn't require me to download and install 1.8 gigabytes of life-sucking Mathematica demo-version just to get a graph that I can draw on a napkin in 4 or 5 seconds ..
Re:XKCD-style charts with D3
by eric_bullington on Thursday October 18, 2012 @09:28PM
(#4671891)
Well done! I actually was planning on tacking this one myself using svg filters but I've been too busy. I didn't see Mike Bostock's comment suggesting the custom line interpolator and wasn't aware of it -- d3 is gaining some cool new functionalities!
Thanks also for the great references. In spite of being a big proponent of d3, I somehow missed the "Toward Reusable Charts" piece Mike wrote earlier this year, which succeeds where I have struggled. I've been using the standard prototypal approach to creating reusable and easily configurable charts, which can be cumbersome for the caller. This functional approach with closures is so much cleaner and more reusable. It's the only way I'll make my d3 charts from now on!
Re:XKCD-style charts with D3
by bryanh on Thursday October 18, 2012 @09:41PM
(#4671924)
Writing code makes repetitive tasks easier: if you want to pump out hundreds or thousands or millions of variations on a graph (using different data, etc...) then drawing it by hand is infeasible.
Edit: as pointed out below, the algorithm was lifted from another version done in Python/Matplotlib by Jake Vanderplas: http://jakevdp.github.com/blog/2012/10/07/xkcd-style-plots-i...
http://xkcdsucks.blogspot.com/2009/03/xkcdsucks-is-proud-to-...
D3 tends to be more roll your own.
I would say this is the nicest result I've seen compared to Python, Mathematica, MATLAB.
Thanks also for the great references. In spite of being a big proponent of d3, I somehow missed the "Toward Reusable Charts" piece Mike wrote earlier this year, which succeeds where I have struggled. I've been using the standard prototypal approach to creating reusable and easily configurable charts, which can be cumbersome for the caller. This functional approach with closures is so much cleaner and more reusable. It's the only way I'll make my d3 charts from now on!
Bonus points for using the Tufte 'lie factor' formula.
I don't understand...
ie: plotting the number of bugs fixed over time