Skip to content

Instantly share code, notes, and snippets.

View vigorousnorth's full-sized avatar

Christian MilNeil vigorousnorth

  • StreetsblogMASS
  • Portland, Maine and Boston, Mass.
  • X @c_milneil
View GitHub Profile
@vigorousnorth
vigorousnorth / d3weathermap.js
Last active August 29, 2015 13:57
D3 weather map
var temps = {};
// Define historic climate data
temps = {
'Bangor' :
{
thiswinter_low: -20, thiswinter_lowdate: 'Jan. 4',
record_low: -32, record_lowdate: 'Feb. 2, 1948', record_lowsince: 1925
@vigorousnorth
vigorousnorth / adaptive.js
Last active August 29, 2015 14:07
Adaptive D3 map and legend.
// Andr Aroo Cumb Frank Hancock Kenne Knox Linc Oxford Penob Pisca Sagada Somerse Waldo Washing York
var data = [99.6, 87.2, 97.8, 70.7, 80.7, 99.1, 98.0, 99.4, 94.5, 88.7, 46.1, 91.9, 79.8, 86.7, 88.5, 98.8 ];
function pair(array) {
return array.slice(1).map(function(b, i) {
return [array[i], b];
});
}
$(document).ready(function() {
@vigorousnorth
vigorousnorth / index.html
Last active January 26, 2016 18:47
D3 animated scatterplot
<!DOCTYPE html>
<html class="ocks-org do-not-copy">
<meta charset="utf-8">
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="urbanizedpopulation.js"></script>
<style>
@vigorousnorth
vigorousnorth / index.html
Last active March 16, 2016 14:50
Animated isometric tetrahedra
<!DOCTYPE html>
<meta charset="utf-8">
<body style="width: 100%">
<canvas width="960" height="500" style="margin-left: auto; margin-right: auto;"></canvas>
<script src="http://d3js.org/d3-timer.v0.3.min.js"></script>
<script src="http://d3js.org/d3-ease.v0.7.min.js"></script>
<script src="isometric.js"></script>
<script>
var canvas = document.querySelector("canvas"),
@vigorousnorth
vigorousnorth / index.html
Last active May 21, 2016 19:26
D3 bar chart with custom SVG path icons
<!DOCTYPE html>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src="windchart.js"></script>
<style>
body {
State suicide-firearm suicide-suffocation suicide-poisoning suicide-other homicide-firearm homicide-other police-firearm others
Wyoming 56.6 13.8 13.2 2.8 5.9 5.5 0.4 1.8
Idaho 54.9 14.6 14.3 3.3 6.2 4.5 1.0 1.2
Montana 54.2 14.4 13.9 2.6 6.4 5.9 0.9 1.7
West Virginia 51.2 11.9 8.9 2.2 14.4 8.5 1.0 1.9
Alaska 49.5 17.0 8.1 2.5 13.0 8.1 0.7 1.1
Vermont 49.3 17.9 15.3 4.6 5.5 4.8 0.7 1.9
North Dakota 49.1 23.2 10.1 5.2 5.4 5.0 2.0
Kentucky 48.7 13.1 8.6 2.4 17.2 8.0 0.6 1.4
Maine 46.9 18.7 16.3 5.9 5.4 4.5 1.0 1.3
State suicide-firearm suicide-suffocation suicide-poisoning suicide-other homicide-firearm homicide-other police-firearm others pct_with_firearms
Wyoming 56.6 13.8 13.2 2.8 5.9 5.5 0.4 1.8 66
Idaho 54.9 14.6 14.3 3.3 6.2 4.5 1 1.2 56
Montana 54.2 14.4 13.9 2.6 6.4 5.9 0.9 1.7 63
West Virginia 51.2 11.9 8.9 2.2 14.4 8.5 1 1.9 58
Alaska 49.5 17 8.1 2.5 13 8.1 0.7 1.1 60
Vermont 49.3 17.9 15.3 4.6 5.5 4.8 0.7 1.9 44
North Dakota 49.1 23.2 10.1 5.2 5.4 5 2 56
Kentucky 48.7 13.1 8.6 2.4 17.2 8 0.6 1.4 48
Maine 46.9 18.7 16.3 5.9 5.4 4.5 1 1.3 40
state geocode suicide_all suicide_gun suicide_other homicide_all homicide_gun homicide_other gun_undetermined_intent avg_population
Alabama 01 3698 2561 1137 2213 1760 453 48 4845480.2
Alaska 02 900 569 331 234 144 90 30 736727.8
Arizona 03 6110 3463 2647 1889 1256 633 63 6734099.8
Arkansas 04 2648 1625 1023 1132 816 316 31 2968265
California 05 20593 7856 12737 9774 6770 3004 61 38714257.2
Colorado 06 5403 2715 2688 1007 621 386 43 5361786.8
Connecticut 07 1858 542 1316 564 373 191 3590088.4
Delaware 08 614 285 329 299 219 80 935290.8
District of Columbia 09 201 46 155 532 386 146 658212.6
State geocode SuicidesPer100K FirearmSuicidesPer100K NonfirearmSuicidesPer100K PctAdultsInHouseholdsWithFirearms SuicideAttemptsPer100K
Alabama 01 17.3 12.3 5 52 0.22
Alaska 02 28.8 18.4 10.4 60 0.23
Arizona 03 21.1 12 9.1 32 0.62
Arkansas 04 19.4 12.6 6.9 59 0.92
California 05 13.5 5.4 8.2 20 0.41
Colorado 06 22.6 11.1 11.6 35 0.42
Connecticut 07 11.3 3.7 7.6 18 1.01
Delaware 08 15.6 5.7 9.9 26 0.12
Florida 10 18.9 9.7 9.2 25 0.52
state geocode SuicidesPer100K FirearmSuicidesPer100K NonfirearmSuicidesPer100K PctAdultsInHouseholdsWithFirearms SuicideAttemptsPer100K BradyScore
Alabama 01 17.3 12.3 5 52 0.22 17.5
Alaska 02 28.8 18.4 10.4 60 0.23 7
Arizona 03 21.1 12 9.1 32 0.62 6
Arkansas 04 19.4 12.6 6.9 59 0.92 15
California 05 13.5 5.4 8.2 20 0.41 89
Colorado 06 22.6 11.1 11.6 35 0.42 28.5
Connecticut 07 11.3 3.7 7.6 18 1.01 84
Delaware 08 15.6 5.7 9.9 26 0.12 48.5
Florida 10 18.9 9.7 9.2 25 0.52 17