Skip to content

Instantly share code, notes, and snippets.

@arfon
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arfon/9122415 to your computer and use it in GitHub Desktop.
Save arfon/9122415 to your computer and use it in GitHub Desktop.
Astropy PR merge fraction

Fraction of pull requests to Astropy merged over time (grouped by month). The size of the dot is proportional to the number of pull requests in that time period (mouseover to see the count).

Data pulled from the GitHub API:

date unix_date merged_count not_merged_count count merge_fraction
2011-07-01 1309478400000 1 0 1 1.0
2011-08-01 1312156800000 4 1 5 0.8
2011-10-01 1317427200000 23 6 29 0.7931034482758621
2011-11-01 1320105600000 32 6 38 0.8421052631578947
2011-12-01 1322697600000 18 1 19 0.9473684210526315
2012-01-01 1325376000000 13 6 19 0.6842105263157895
2012-02-01 1328054400000 20 2 22 0.9090909090909091
2012-03-01 1330560000000 4 3 7 0.5714285714285714
2012-04-01 1333238400000 11 5 16 0.6875
2012-05-01 1335830400000 22 6 28 0.7857142857142857
2012-06-01 1338508800000 38 4 42 0.9047619047619048
2012-07-01 1341100800000 12 2 14 0.8571428571428571
2012-08-01 1343779200000 14 1 15 0.9333333333333333
2012-09-01 1346457600000 18 1 19 0.9473684210526315
2012-10-01 1349049600000 26 5 31 0.8387096774193549
2012-11-01 1351728000000 37 10 47 0.7872340425531915
2012-12-01 1354320000000 44 2 46 0.9565217391304348
2013-01-01 1356998400000 80 7 87 0.9195402298850575
2013-02-01 1359676800000 69 9 78 0.8846153846153846
2013-03-01 1362096000000 48 7 55 0.8727272727272727
2013-04-01 1364774400000 52 12 64 0.8125
2013-05-01 1367366400000 62 16 78 0.7948717948717948
2013-06-01 1370044800000 37 6 43 0.8604651162790697
2013-07-01 1372636800000 51 11 62 0.8225806451612904
2013-08-01 1375315200000 54 2 56 0.9642857142857143
2013-09-01 1377993600000 79 6 85 0.9294117647058824
2013-10-01 1380585600000 129 23 152 0.8486842105263158
2013-11-01 1383264000000 67 17 84 0.7976190476190477
2013-12-01 1385856000000 63 5 68 0.9264705882352942
2014-01-01 1388534400000 49 11 60 0.8166666666666667
2014-02-01 1391212800000 75 13 88 0.8522727272727273
2014-03-01 1393632000000 55 11 66 0.8333333333333334
2014-04-01 1396310400000 70 24 94 0.7446808510638298
2014-05-01 1398902400000 119 14 133 0.8947368421052632
2014-06-01 1401580800000 49 7 56 0.875
2014-07-01 1404172800000 61 27 88 0.6931818181818182
2014-08-01 1406851200000 52 14 66 0.7878787878787878
2014-09-01 1409529600000 48 9 57 0.8421052631578947
2014-10-01 1412121600000 25 5 30 0.8333333333333334
2014-11-01 1414800000000 45 18 63 0.7142857142857143
2014-12-01 1417392000000 8 10 18 0.4444444444444444
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 12px sans-serif;
}
.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.dot {
stroke: red;
fill: red;
}
h1{
padding-left:25px;
}
</style>
<body>
<script src="http://d3js.org/d3.v3.js"></script>
<script>
var margin = {top: 20, right: 20, bottom: 30, left: 50},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var parseDate = d3.time.format("%Y-%m-%d").parse;
var x = d3.time.scale()
.range([0, width]);
var y = d3.scale.linear()
.range([height, 0]);
var xAxis = d3.svg.axis()
.scale(x)
.orient("bottom");
var yAxis = d3.svg.axis()
.scale(y)
.orient("left");
var svg = d3.select("body").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
d3.tsv("astropy_merge_fraction.tsv", function(error, data) {
data.forEach(function(d) {
d.date = parseDate(d.date);
d.unix_date = +d.unix_date;
d.merged_count = +d.merged_count;
d.not_merged_count = +d.not_merged_count;
d.count = +d.count;
d.merge_fraction = +d.merge_fraction;
});
x.domain(d3.extent(data, function(d) { return d.date; }));
y.domain(d3.extent(data, function(d) { return d.merge_fraction; }));
var median_pull_count = d3.median(data, function(d) { return d.count; });
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);
svg.append("g")
.attr("class", "y axis")
.call(yAxis)
.append("text")
.attr("transform", "rotate(-90)")
.attr("y", 6)
.attr("dy", ".71em")
.style("text-anchor", "end")
.text("Merge fraction");
svg.selectAll(".dot")
.data(data)
.enter().append("circle")
.attr("class", "dot")
.attr("r", function(d) { return 3 * d.count/median_pull_count; })
.attr("cx", function(d) { return x(d.date); })
.attr("cy", function(d) { return y(d.merge_fraction); })
.append("svg:title")
.text(function(d) { return d.count; });
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment