Created
April 7, 2015 06:06
-
-
Save jaeahlee/eaa2c3ba3a644a2d86dc to your computer and use it in GitHub Desktop.
Criminal Careers Project: Total arrests by crime, 2012
This file contains 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
crime | under18 | 18OrOver | under10 | 10_12 | 13_14 | Under15 | 15 | 16 | 17 | 18_20 | 21_24 | 25_29 | 30_34 | 35_39 | 40_44 | 45_49 | 50_54 | 55_59 | 60_64 | 65OrOver | totalAllAges | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
murderAndNonNegligentManslaughter | 724 | 10351 | 1 | 12 | 68 | 82 | 100 | 207 | 335 | 1965 | 2341 | 1897 | 1284 | 835 | 615 | 536 | 387 | 231 | 135 | 125 | 11075 | |
forcibleRape | 2527 | 15571 | 8 | 229 | 706 | 943 | 436 | 510 | 637 | 2461 | 2514 | 2357 | 2123 | 1622 | 1502 | 1242 | 813 | 469 | 251 | 217 | 18098 | |
robbery | 21472 | 82189 | 35 | 525 | 3645 | 4205 | 4319 | 5887 | 7061 | 22364 | 18907 | 14073 | 9347 | 5540 | 4696 | 3694 | 2199 | 905 | 322 | 142 | 103661 | |
aggravatedAssault | 36345 | 352017 | 348 | 3109 | 8516 | 11973 | 6882 | 8376 | 9114 | 38139 | 59621 | 62891 | 51626 | 36858 | 32754 | 28306 | 20892 | 11460 | 5265 | 4205 | 388362 | |
burglary | 53773 | 229809 | 433 | 3123 | 11467 | 15022 | 10425 | 13118 | 15208 | 50480 | 45595 | 39837 | 29443 | 18949 | 16936 | 13674 | 8909 | 3910 | 1298 | 779 | 283582 | |
larcenyTheft | 224180 | 1058172 | 1036 | 14413 | 49575 | 65023 | 42263 | 54540 | 62353 | 193840 | 183513 | 173148 | 135370 | 94527 | 88767 | 77647 | 57478 | 30540 | 13412 | 9930 | 1282352 | |
motorVehicleTheft | 13078 | 55767 | 12 | 291 | 2441 | 2744 | 2989 | 3685 | 3660 | 10286 | 10258 | 10330 | 8442 | 5595 | 4497 | 3232 | 1876 | 808 | 292 | 150 | 68845 | |
arson | 4355 | 7078 | 227 | 893 | 1451 | 2571 | 689 | 584 | 512 | 1149 | 1069 | 1084 | 907 | 710 | 563 | 602 | 474 | 281 | 141 | 98 | 11433 | |
otherAssaults | 173078 | 1026398 | 2073 | 17616 | 47953 | 67642 | 33040 | 36310 | 36087 | 110091 | 172097 | 181682 | 151007 | 110415 | 99929 | 84621 | 60704 | 30737 | 13814 | 11299 | 1199476 | |
forgeryAndCounterfeiting | 1441 | 65605 | 5 | 26 | 167 | 197 | 151 | 337 | 756 | 7295 | 10976 | 12772 | 10935 | 7569 | 6132 | 4637 | 3020 | 1400 | 556 | 310 | 67046 | |
fraud | 4718 | 148817 | 19 | 138 | 709 | 865 | 725 | 1248 | 1879 | 14208 | 20998 | 25508 | 23380 | 18155 | 16548 | 12662 | 8503 | 4844 | 2280 | 1732 | 153535 | |
embezzlement | 437 | 15586 | 0 | 5 | 25 | 30 | 34 | 121 | 253 | 2486 | 3204 | 2555 | 2060 | 1533 | 1396 | 1006 | 669 | 397 | 180 | 100 | 16023 | |
stolenPropertyBuyingReceivingPossessing | 12935 | 84735 | 37 | 461 | 2435 | 2932 | 2615 | 3342 | 4046 | 15208 | 16296 | 15803 | 12305 | 7989 | 6784 | 4984 | 3156 | 1386 | 554 | 270 | 97670 | |
vandalism | 59938 | 168525 | 1117 | 6527 | 15869 | 23513 | 10969 | 12689 | 12767 | 34633 | 35438 | 29817 | 20981 | 13738 | 11586 | 9495 | 6758 | 3295 | 1521 | 1263 | 228463 | |
weaponsCarryingPossessingEtc | 24688 | 124598 | 527 | 2321 | 5615 | 8463 | 4273 | 5444 | 6507 | 23007 | 26643 | 23270 | 16862 | 10010 | 7961 | 6378 | 5007 | 2771 | 1428 | 1261 | 149286 | |
prostitutionAndCommercializedVice | 790 | 55785 | 0 | 6 | 53 | 59 | 108 | 234 | 388 | 6339 | 9987 | 9789 | 7571 | 5866 | 5870 | 4826 | 2959 | 1449 | 635 | 494 | 56575 | |
sexOffenseExceptForcibleRapeAndProstitution | 12427 | 55928 | 233 | 1849 | 4160 | 6243 | 2111 | 1995 | 2078 | 7139 | 7239 | 7253 | 6683 | 5642 | 5601 | 5260 | 4410 | 2853 | 1735 | 2113 | 68355 | |
drugAbuseViolationsTotal | 140038 | 1412394 | 155 | 3219 | 20847 | 24222 | 23278 | 36749 | 55790 | 264349 | 288245 | 256952 | 189877 | 120752 | 101714 | 84309 | 60631 | 29696 | 11125 | 4744 | 1552432 | |
saleManufacturingTotal | 18449 | 259353 | 20 | 429 | 2713 | 3162 | 3266 | 4896 | 7125 | 38135 | 50195 | 49773 | 38976 | 25300 | 20093 | 15851 | 11302 | 5912 | 2493 | 1322 | 277802 | |
possessionSubTotal | 121589 | 1153041 | 135 | 2790 | 18134 | 21060 | 20012 | 31853 | 48665 | 226214 | 238050 | 207179 | 150901 | 95452 | 81621 | 68458 | 49329 | 23783 | 8632 | 3422 | 1274630 | |
gambling | 957 | 6911 | 1 | 13 | 85 | 99 | 168 | 299 | 391 | 1501 | 1354 | 953 | 587 | 486 | 507 | 412 | 386 | 294 | 226 | 206 | 7868 | |
offensesAgainstTheFamilyAndChildren | 3340 | 103678 | 67 | 238 | 762 | 1067 | 658 | 780 | 835 | 5383 | 12278 | 18763 | 19290 | 15621 | 12985 | 9273 | 5834 | 2639 | 955 | 656 | 107018 | |
drivingUnderTheInfluence | 9388 | 1273569 | 25 | 15 | 141 | 181 | 374 | 2135 | 6698 | 89219 | 234470 | 233153 | 175145 | 127324 | 118266 | 106703 | 88395 | 53094 | 27823 | 19977 | 1282957 | |
liquorLaws | 77813 | 363719 | 53 | 538 | 6887 | 7479 | 11373 | 21974 | 36987 | 220647 | 30395 | 19626 | 15745 | 12810 | 14900 | 17233 | 16176 | 9313 | 4451 | 2423 | 441532 | |
drunkenness | 9898 | 501373 | 33 | 85 | 1085 | 1203 | 1579 | 2296 | 4820 | 41826 | 81852 | 75089 | 60904 | 47437 | 50492 | 53794 | 47551 | 26213 | 10745 | 5471 | 511271 | |
disorderlyConduct | 120133 | 423862 | 835 | 10331 | 34934 | 46100 | 24579 | 25331 | 24123 | 61793 | 84932 | 68761 | 51469 | 36745 | 34224 | 32836 | 27145 | 14625 | 6708 | 4623 | 543995 | |
vagrancy | 1420 | 25583 | 1 | 58 | 308 | 367 | 341 | 370 | 342 | 3139 | 2991 | 2847 | 2624 | 2162 | 2669 | 3064 | 3054 | 1847 | 803 | 383 | 27003 | |
suspicion | 345 | 1187 | 6 | 33 | 79 | 118 | 76 | 90 | 61 | 216 | 235 | 190 | 151 | 99 | 78 | 85 | 56 | 47 | 15 | 15 | 1532 |
This file contains 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 { | |
} | |
svg { | |
background-color: white; | |
border: 2px solid #eee; | |
padding: 5px; | |
fill: #FB8752; | |
} | |
</style> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var svg = d3.select("body") | |
.append("svg") | |
.attr("width", 700) | |
.attr("height", 500); | |
d3.csv("arrestsByAge2012.csv", function(data) { | |
data.sort(function(a, b) { | |
return d3.descending(+a.totalAllAges, +b.totalAllAges); | |
//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", 225) | |
.attr("y", function(d, i) { | |
return i * 18; | |
}) | |
.attr("width", function(d) { | |
return d.totalAllAges * .0003; | |
}) | |
.attr("height", 15) | |
.append("title") | |
.text(function(d) { | |
return d.crime + "'s number of arrests is " + d.totalAllAges; | |
}); | |
var crime = svg.selectAll("text") | |
.data(data) | |
.enter() | |
.append("text"); | |
crime.attr("x", 220) | |
.attr("y", function(d,i) { | |
return i * 18 + 11; }) | |
.attr("fill", "black") | |
.attr("font-size", "10px") | |
.attr("font-weight", "normal") | |
.attr("font-family", "sans-serif") | |
.attr("text-anchor", "end") | |
.text(function(d) { | |
return d.crime}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment