Skip to content

Instantly share code, notes, and snippets.

View nstrayer's full-sized avatar

Nick Strayer nstrayer

View GitHub Profile
nstrayer /
Last active August 29, 2015 14:26 — forked from bbest/.block
Aster Plot in D3

This aster plot displays pie slices as lengths extending outward to the edge (0 at inner to 100 at outer). Widths of the pie slices represent the weight of each pie, which gets used to arrive at a weighted mean of the length scores in the center.


Jim Regetz @regetz developed the initial aster plot function in R (see aster-plot on github)

Parker Abercrombie @parkerabercrombie developed the initial D3 prototype varying 3 of the 4 arc elements starting with Mike Bostock's Donut Chart:

  • outerRadius
  • startAngle
nstrayer /
Last active August 29, 2015 14:26 — forked from kerryrodden/.block
Sequences sunburst

This example shows how it is possible to use a D3 sunburst visualization (partition layout) with data that describes sequences of events.

A good use case is to summarize navigation paths through a web site, as in the sample synthetic data file (visit_sequences.csv). The visualization makes it easy to understand visits that start directly on a product page (e.g. after landing there from a search engine), compared to visits where users arrive on the site's home page and navigate from there. Where a funnel lets you understand a single pre-selected path, this allows you to see all possible paths.


  • works with data that is in a CSV format (you don't need to pre-generate a hierarchical JSON file, unless your data file is very large)
  • interactive breadcrumb trail helps to emphasize the sequence, so that it is easy for a first-time user to understand what they are seeing
  • percentages are shown explicitly, to help overcome the distortion of the data that occurs wh
nstrayer /
Last active August 29, 2015 14:26 — forked from mbostock/.block
Voronoi Tessellation
nstrayer /
Last active August 29, 2015 14:26 — forked from jasondavies/
Areas of Clipped Voronoi Regions

A demonstration of how to calculate the areas of Voronoi regions clipped by geographic features using D3.

[D3’s implementation](Sutherland–Hodgman algorithm) of the Sutherland–Hodgman algorithm only works for convex clip polygons, but we exploit the fact that Voronoi regions are guaranteed to be convex, and use each Voronoi region as a clip polygon, with the projected geographic boundary as a subject polygon.

In response to a question by Gonzalo Bellver.

nstrayer /
Last active August 29, 2015 14:26 — forked from mbostock/.block

These county, state and country boundaries are extracted from a single TopoJSON file. Counties are stroked in thin gray, states in thin black, and the country in thick black.

nstrayer /
Created December 30, 2015 04:21 — forked from mbostock/.block
Percentage Change II

A variation of the percentage change example using clipping to apply different colors for positive change (green) and negative change (purple).

nstrayer /
Created January 5, 2016 19:40 — forked from blacki/
K-Means Algorithm

K-Means Unsupervised Learning Algorithm

nstrayer /
Last active January 30, 2016 23:16
(not quite) simple tables in D3

Forked from Gregor Aisch's Block simple tables in D3.

Inspired by a question posted in the comments about using the cell values in a given row to color code the background of that cell.

nstrayer / index.html
Created June 12, 2016 17:39 — forked from emeeks/index.html
Ch. 11, Fig. 14 - D3.js in Action
<title>D3 in Action Chapter 11 - Example 8</title>
<meta charset="utf-8" />
<script src=""></script>
body, html {
margin: 0;
nstrayer / .block
Created May 10, 2016 21:17 — forked from mbostock/.block
Cluster Dendrogram
license: gpl-3.0