Skip to content

Instantly share code, notes, and snippets.

View wboykinm's full-sized avatar

Bill Morris wboykinm

View GitHub Profile
@wboykinm
wboykinm / README.md
Last active May 31, 2016 17:46 — forked from veltman/README.md
Strip map

Creating an automatic strip map based on some geographic features and a chosen "spine." The approximate steps:

  1. Pick a LineString (e.g. the Norway coast) to straighten out.
  2. Simplify that LineString.
  3. Turn that simplified LineString into a set of zones, one per segment.
  4. Rotate/translate each zone to its destination position, anchoring it to the end of the previous segment and rotating it to match the desired angle (e.g. horizontal).
  5. Warp the contents of each zone to the resulting rectangle with a bilinear warp.

Steps 4 & 5 are separate for this demo but they could be calculated in a single step in real life.

@wboykinm
wboykinm / index.html
Created May 24, 2016 00:37 — forked from pgiraud/index.html
D3js save SVG file
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
.axis path,
.axis line {
@wboykinm
wboykinm / histogram.sql
Created October 12, 2015 13:07 — forked from wolever/histogram.sql
Functions to create and draw histograms with PostgreSQL.
-- Functions to create and draw histograms with PostgreSQL.
-- psql> select * from show_histogram((select histogram(length(email), 0, 32, 6) FROM auth_user limit 100));
-- bucket | range | count | bar | cumbar | cumsum | cumpct
-- --------+-------------------------------------+-------+--------------------------------+--------------------------------+--------+------------------------
-- 0 | [0,5.33333333333333) | 1 | | | 1 | 0.00273224043715846995
-- 1 | [5.33333333333333,10.6666666666667) | 5 | = | | 6 | 0.01639344262295081967
-- 2 | [10.6666666666667,16) | 149 | ============================== | ============= | 155 | 0.42349726775956284153
-- 3 | [16,21.3333333333333) | 145 | =========
@wboykinm
wboykinm / admin1_polygons_topo.json
Last active August 29, 2015 14:27 — forked from emeeks/d3.sketchy.js
Sketchy Continental USA
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wboykinm
wboykinm / README.md
Last active August 29, 2015 14:27 — forked from mbostock/.block
Choropleth

This choropleth encodes unemployment rates from 2008 with a quantize scale ranging from 0 to 15%. A threshold scale is a useful alternative for coloring arbitrary ranges.

@wboykinm
wboykinm / README.md
Last active August 29, 2015 14:26 — forked from marcneuwirth/index.html
D3 Globe
{
"Arial Unicode MS": [
"Arial Unicode MS Regular",
"Arial Unicode MS Bold"
],
"Brokenscript OT": [
"Brokenscript OT Bold",
"Brokenscript OT Cond Bold"
],
"Brokenscript Rough OT": [
@wboykinm
wboykinm / README.md
Last active August 29, 2015 14:21 — forked from PatrickStotz/README.md

A Spinning globe with glowing city markers in D3.

Note: This visualization constantly recalculates and reprojects the position of over 4000 markers and thus needs a lot of computation power. Older computer and mobile devices might struggle with the rendering process. Furthermore the visualization is only optimized for Chrome browsers and might look different than expected when opened in other browsers.

By Patrick Stotz, inspired by Curran Kelleher's idea to plot a world map in D3 by using the GeoNames database as seen in his great Introdction to D3 video.

An example of a continuous gradient key that can be adopted whenever there is a need for a gradient coloring scheme.

<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.7.0/mapbox-gl.js'></script>
<script src='tx.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.7.0/mapbox-gl.css' rel='stylesheet' />
<style>