Skip to content

Instantly share code, notes, and snippets.

View alecrajeev's full-sized avatar

Alec Rajeev alecrajeev

View GitHub Profile
@alecrajeev
alecrajeev / index.html
Last active August 29, 2015 14:23
Job's Change
<!DOCTYPE html>
<meta charset="utf-8">
<title>Job's Numbers </title>
<style>
svg {
border: 1px solid #f0f;
}
rect:hover {
@alecrajeev
alecrajeev / barley.tsv
Last active August 29, 2015 14:24
A graphs of Barley farming at different sites
yield variety year site
27 Manchuria 1931 University Farm
48.86667 Manchuria 1931 Waseca
27.43334 Manchuria 1931 Morris
39.93333 Manchuria 1931 Crookston
32.96667 Manchuria 1931 Grand Rapids
28.96667 Manchuria 1931 Duluth
43.06666 Glabron 1931 University Farm
55.2 Glabron 1931 Waseca
28.76667 Glabron 1931 Morris
@alecrajeev
alecrajeev / Readme.md
Last active September 5, 2015 23:17
Bernie Sanders Organization by Congressional District

Bernie Sanders Event Attendance by Congressional Districts.

Background on Map

The purpose of this map as detailed on Daily Kos is to represent the congressional districts in the United States accurately. Currently it is difficult to show the districts because some such as those in New York City are very small, while others like Montana are the size of an entire state. Previosly the maps needed to be zoomable to see the districts containing cities. Other representations such as cartograms warped the country's shape. This map attempts to fix that by giving each congressional district equal area i.e. five regular hexagons.

Bernie Sanders Event Data

The data about Bernie Sanders' events comes from the non-affiliated website bernie2016events. The data that I parsed is a about two weeks old, so it is not completely up

@alecrajeev
alecrajeev / colorBuilder.js
Last active September 25, 2015 00:00
Who Drew the Lines?
// this is the javascript file that has all the functions that regarding color
var color = d3.scale.linear() // initial color scale for the demographic data
.range(['rgb(247,252,245)','rgb(229,245,224)','rgb(199,233,192)','rgb(161,217,155)','rgb(116,196,118)','rgb(65,171,93)','rgb(35,139,69)','rgb(0,109,44)','rgb(0,68,27)']);
var voteColor = d3.scale.ordinal() // color scale for a specifc vote
.range(["#7A9CC7","#DA9285","#a9a9a9","#405695","#B43030"])
.domain([0, 1, 2, 3, 4]);
var bernieColor = d3.scale.ordinal() // color scale for bernie event data
@alecrajeev
alecrajeev / index.html
Last active October 14, 2015 01:56
Bifurcation Plot
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Bifurcation Plot </title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/queue-async/1.0.7/queue.min.js"></script>
<style>
svg {
border: 1px solid #f0f;
}
@alecrajeev
alecrajeev / index.html
Last active January 30, 2016 06:26
Iris Data
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Iris Data </title>
<link rel="stylesheet", type="text/css", href="style.css">
</head>
<body>
@alecrajeev
alecrajeev / README.md
Last active March 26, 2016 08:30
United States Congressional Districts Hexagons

U.S. Congressional Districts as Hexagons.

Background

The purpose of this map as detailed on Daily Kos is to represent the congressional districts in the United States accurately. Currently it is difficult to show the districts because some such as those in New York City are very small, while others like Montana are the size of an entire state. Previosly the maps needed to be zoomable to see the districts containing cities. Other represntations such as cartograms warped the country's shape. This map attempts to fix that by giving each congressional district equal area i.e. five regular hexagons.

According to the original Daily Kos article, the map was built by Daniel Donner.

Porting the Map

I did not design the map. This project's purpose is to port the map to a more useable format. I ported the map t

@alecrajeev
alecrajeev / colorBuilder.js
Last active April 11, 2016 01:03
Republican Primary
// this is the javascript file that has all the functions that regarding color
var color = d3.scale.linear() // initial color scale for the demographic data
.range(['rgb(247,252,245)','rgb(229,245,224)','rgb(199,233,192)','rgb(161,217,155)','rgb(116,196,118)','rgb(65,171,93)','rgb(35,139,69)','rgb(0,109,44)','rgb(0,68,27)']);
var candidateMargin = [0.0, 0.05, 0.1, 0.25, 1.0];
var republicanStateColors = ["#e41a1c", "#984ea3", "#4daf4a", "#377eb8", "#D3D3D3"];
var marginColors = ['#fee5d9','#fcae91','#fb6a4a','#de2d26','#a50f15', '#f2f0f7','#cbc9e2','#9e9ac8','#756bb1','#54278f', '#bae4b3', '#bdd7e7', "#D3D3D3"];
@alecrajeev
alecrajeev / README.md
Last active June 8, 2016 19:52
Democratic Primary 2016

Democratic Primary 2016 by CD

Background

The purpose of this map as detailed on Daily Kos is to represent the congressional districts in the United States accurately. Currently it is difficult to show the districts because some such as those in New York City are very small, while others like Montana are the size of an entire state. Previosly the maps needed to be zoomable to see the districts containing cities. Other represntations such as cartograms warped the country's shape. This map attempts to fix that by giving each congressional district equal area i.e. five regular hexagons.

The map was built by Daniel Donner.

I ported the map using d3 to make it easier to use.

The raw data on the race comes from The Green Papers, but I adapted it slightly to my use in [google s

@alecrajeev
alecrajeev / colorBuilder.js
Last active April 27, 2017 17:54
House 2018 Election
// this is the javascript file that has all the functions that regarding color
var color = d3.scale.linear() // initial color scale for the demographic data
.range(['rgb(247,252,245)','rgb(229,245,224)','rgb(199,233,192)','rgb(161,217,155)','rgb(116,196,118)','rgb(65,171,93)','rgb(35,139,69)','rgb(0,109,44)','rgb(0,68,27)']);
var eleven_domain = [-1.0,-0.3,-0.2,-0.1,-0.05,0.0,0.05,0.1,0.2,0.3,1.0];
var color1;
var stateColor = ["#A94588","#D76940","#D13F46","#23A5C5", "#F0A851", "#F0A851", "#726198", "#23A5C5", "#228947", "#2B6AA1", "#D13F46", "#A94588", "#A94588",
"#2B6AA1", "#F0A851", "#D76940", "#D13F46", "#D13F46", "#6EAE51", "#A94588", "#A94588", "#D76940", "#D13F46", "#F0A851", "#228947", "#D76940", "#23A5C5",
"#23A5C5", "#D13F46", "#6EAE51", "#A94588", "#2B6AA1", "#23A5C5", "#2B6AA1", "#6EAE51", "#2B6AA1", "#2B6AA1", "#D13F46", "#23A5C5", "#6EAE51", "#6EAE51",