Created
September 3, 2015 13:36
-
-
Save unamandita/e1dd420591aaa72b3a11 to your computer and use it in GitHub Desktop.
Module #3 experiments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hospitalName | hospitalCounty | vaginalBirths | cesareanBirths | attendedByLicensedMidwife | artificialRuptureOfMembranes | medicinalInduction | internalFetalMonitoring | externalFetalMonitoring | augmentedLabor | fedExclusivelyBreastMilk | |
---|---|---|---|---|---|---|---|---|---|---|---|
Bronx-Lebanon Hospital Center - Concourse Division | BRONX | 0.662 | 0.338 | 0 | 0.08 | 0.081 | 0.113 | 0.525 | 0.07 | 0.014 | |
Montefiore Medical Center - North Division | BRONX | 0.665 | 0.335 | 0 | 0 | 0.085 | 0.003 | 0.997 | 0.042 | 0.274 | |
Montefiore Med Center - Jack D Weiler Hosp of A Einstein College Div | BRONX | 0.667 | 0.333 | 0.012 | 0 | 0.075 | 0.001 | 0.996 | 0.003 | 0.18 | |
Jacobi Medical Center | BRONX | 0.694 | 0.306 | 0.621 | 0.119 | 0.218 | 0.153 | 0.859 | 0.113 | 0.542 | |
Lincoln Medical & Mental Health Center | BRONX | 0.702 | 0.298 | 0 | 0.164 | 0.237 | 0.194 | 0.927 | 0.229 | 0.233 | |
North Central Bronx Hospital | BRONX | 0.742 | 0.258 | 0.677 | 0.079 | 0.218 | 0.209 | 0.952 | 0.123 | 0.088 | |
St Barnabas Hospital | BRONX | 0.746 | 0.254 | 0.204 | 0.042 | 0.155 | 0.046 | 0.685 | 0.14 | 0.159 | |
University Hospital of Brooklyn | KINGS | 0.474 | 0.526 | 0.001 | 0.083 | 0.092 | 0.015 | 0.948 | 0.173 | 0.531 | |
Brooklyn Hospital Center - Downtown Campus | KINGS | 0.615 | 0.385 | 0 | 0 | 0 | 0.001 | 0.992 | 0.001 | 0 | |
Wyckoff Heights Medical Center | KINGS | 0.634 | 0.366 | 0.003 | 0.266 | 0.107 | 0.192 | 0.949 | 0.353 | 0.215 | |
Coney Island Hospital | KINGS | 0.636 | 0.364 | 0.486 | 0.091 | 0.143 | 0.251 | 0.925 | 0.271 | 0.061 | |
Brookdale Hospital Medical Center | KINGS | 0.644 | 0.356 | 0.251 | 0.097 | 0.23 | 0.121 | 0.823 | 0.398 | 0.255 | |
New York Methodist Hospital | KINGS | 0.658 | 0.342 | 0.086 | 0.075 | 0.073 | 0.111 | 0.948 | 0.151 | 0.156 | |
Long Island College Hospital | KINGS | 0.66 | 0.34 | 0.077 | 0.026 | 0.134 | 0.149 | 0.986 | 0.337 | 0.216 | |
Lutheran Medical Center | KINGS | 0.663 | 0.337 | 0.018 | 0.521 | 0.338 | 0.013 | 0.997 | 0.226 | 0.563 | |
Woodhull Medical & Mental Health Center | KINGS | 0.701 | 0.299 | 0.605 | 0.056 | 0.187 | 0.287 | 0.927 | 0.2 | 0.423 | |
Kings County Hospital Center | KINGS | 0.747 | 0.253 | 0.137 | 0.319 | 0.131 | 0.24 | 0.985 | 0.243 | 0.315 | |
Maimonides Medical Center | KINGS | 0.763 | 0.237 | 0.201 | 0.047 | 0.133 | 0.112 | 0.946 | 0.2 | 0.18 | |
Lenox Hill Hospital | NEW YORK | 0.594 | 0.406 | 0 | 0.006 | 0.345 | 0 | 0.989 | 0.333 | 0.309 | |
New York Presbyterian Hospital - Columbia Presbyterian Center | NEW YORK | 0.597 | 0.403 | 0.001 | 0.187 | 0.219 | 0.09 | 0.856 | 0.145 | 0.494 | |
New York Presbyterian Hospital - Allen Pavilion | NEW YORK | 0.608 | 0.392 | 0.007 | 0.138 | 0.198 | 0.114 | 0.762 | 0.179 | 0.202 | |
New York Presbyterian Hospital - New York Weill Cornell Center | NEW YORK | 0.646 | 0.354 | 0 | 0.037 | 0.067 | 0.039 | 0.552 | 0.058 | 0.562 | |
Mount Sinai Hospital | NEW YORK | 0.655 | 0.345 | 0.088 | 0.141 | 0.198 | 0.022 | 0.991 | 0.204 | 0.279 | |
Harlem Hospital Center | NEW YORK | 0.666 | 0.334 | 0.003 | 0.041 | 0.141 | 0.321 | 0.945 | 0.158 | 0.286 | |
Bellevue Hospital Center | NEW YORK | 0.689 | 0.311 | 0.249 | 0.148 | 0.248 | 0.097 | 0.932 | 0.212 | 0.284 | |
St Lukes Roosevelt Hospital Center - Roosevelt Hospital Division | NEW YORK | 0.691 | 0.309 | 0.094 | 0.093 | 0.234 | 0.048 | 0.891 | 0.257 | 0.291 | |
NYU Hospitals Center | NEW YORK | 0.72 | 0.28 | 0 | 0.219 | 0.117 | 0.002 | 0.967 | 0.196 | 0.284 | |
Beth Israel Medical Center/Petrie Campus | NEW YORK | 0.726 | 0.274 | 0.137 | 0.112 | 0.12 | 0.114 | 0.794 | 0.216 | 0.095 | |
New York Downtown Hospital | NEW YORK | 0.728 | 0.272 | 0.018 | 0.013 | 0.046 | 0 | 0.945 | 0.014 | 0.908 | |
Metropolitan Hospital Center | NEW YORK | 0.733 | 0.267 | 0.241 | 0.096 | 0.146 | 0.207 | 0.972 | 0.291 | 0.703 | |
Jamaica Hospital Medical Center | QUEENS | 0.592 | 0.408 | 0.074 | 0.006 | 0.002 | 0 | 0.981 | 0.018 | 0.073 | |
Flushing Hospital Medical Center | QUEENS | 0.602 | 0.398 | 0.001 | 0.028 | 0.372 | 0.001 | 0.839 | 0.521 | 0.113 | |
Long Island Jewish Medical Center | QUEENS | 0.626 | 0.374 | 0.002 | 0.178 | 0.175 | 0.064 | 0.994 | 0.268 | 0.19 | |
St Johns Episcopal Hospital So Shore | QUEENS | 0.634 | 0.366 | 0 | 0.006 | 0.098 | 0.001 | 0.987 | 0.067 | 0.518 | |
New York Hospital Medical Center of Queens | QUEENS | 0.661 | 0.339 | 0 | 0.419 | 0.046 | 0.151 | 0.981 | 0.307 | 0.312 | |
Forest Hills Hospital | QUEENS | 0.668 | 0.332 | 0.002 | 0.069 | 0.069 | 0.058 | 0.973 | 0.103 | 0.101 | |
Queens Hospital Center | QUEENS | 0.692 | 0.308 | 0 | 0.066 | 0.213 | 0.1 | 0.787 | 0.25 | 0.724 | |
Elmhurst Hospital Center | QUEENS | 0.7 | 0.3 | 0.123 | 0.207 | 0.159 | 0.059 | 0.881 | 0.159 | 0.298 | |
Richmond University Medical Center | RICHMOND | 0.569 | 0.431 | 0.002 | 0.546 | 0.143 | 0.019 | 0.498 | 0.033 | 0.331 | |
Staten Island University Hosp-North | RICHMOND | 0.773 | 0.227 | 0.032 | 0.001 | 0.149 | 0.003 | 0.989 | 0.086 | 0.299 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Adding Tooltips</title> | |
<script type="text/javascript" src="http://d3js.org/d3.v3.js"></script> | |
<style type="text/css"> | |
body { | |
font-family: "Helvetica"; | |
font-size: 24px; | |
background-color: #4C4548; | |
color: white; | |
padding-top: 10px; | |
padding-bottom: 10px; | |
padding-left: 20px; | |
} | |
svg { | |
background-color: white; | |
margin-top: 10px; | |
} | |
</style> | |
</head> | |
<body> | |
C-section births at NYC hospitals in 2013 (percent) | |
<!-- <br> | |
<svg> | |
<line x1= "100" x2="100" y1="0" y2="636" stroke="black" stroke-width="1" /> | |
</svg> --> | |
<script type="text/javascript"> | |
var svg = d3.select("body") | |
.append("svg") | |
.attr("width", 1000) | |
.attr("height", 995) | |
.attr("fill", "#EF97B4"); | |
var divisions = [100, 200, 300, 400, 500, 600, 700, 800, 900]; | |
var lines = svg.selectAll("line") | |
.data(divisions) | |
.enter() | |
.append("line"); | |
lines.attr("x1", function(divisions){ | |
return divisions; | |
}) | |
.attr("x2", function(divisions){ | |
return divisions; | |
}) | |
.attr("y1", 0) | |
.attr("y2", 995) | |
.attr("stroke", "#4C4548") | |
.attr("stroke-width", 1); | |
d3.csv("hospital_maternity_info_2013.csv", function(data) { | |
data.sort(function(a, b) { | |
return d3.ascending(a.cesareanBirths, b.cesareanBirths); | |
//If your numeric values aren't sorting properly, | |
//try commenting out the line above, and instead using: | |
// | |
//return d3.descending(+a.lifeSatisfaction, +b.lifeSatisfaction); | |
// | |
//Data coming in from the CSV is saved as strings (text), | |
//so the + signs here force JavaScript to treat those | |
//strings instead as numeric values, thereby fixing the | |
//sort order (hopefully!). | |
}); | |
var rects = svg.selectAll("rect") | |
.data(data) | |
.enter() | |
.append("rect"); | |
rects.attr("x", 0) | |
.attr("y", function(d, i) { | |
return i * 25; | |
}) | |
.attr("width", function(d) { | |
return d.cesareanBirths * 1000; | |
}) | |
.attr("height", 20) | |
.attr("opacity", 0.85) | |
.append("title") | |
.text(function(d) { | |
return Math.round(d.cesareanBirths*1000)/10 + "% of births at " + d.hospitalName + " were delivered via cesarean section."; | |
}); | |
svg.selectAll("text") | |
.data(data) | |
.enter() | |
.append("text") | |
.text(function(d){ | |
return Math.round(d.cesareanBirths * 1000)/10 + "%"; | |
}) | |
.attr("fill", "white") | |
.attr("font-size", 12) | |
.attr("text-anchor", "middle") | |
.attr("y", function(d, i){ | |
return (i * 25) + 14; | |
}) | |
.attr("x", function(d){ | |
return (d.cesareanBirths * 1000) - 22; | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment