Built with blockbuilder.org
Last active
May 7, 2017 04:20
-
-
Save maelafifi/3f2cb16d6adf845423d97c3623fa50c3 to your computer and use it in GitHub Desktop.
scatter
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
license: mit |
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
Occupation | workersMen | earningsMen | earningsWomen | workersWomen | |
---|---|---|---|---|---|
Chief executives | 832 | 2419 | 1876 | 318 | |
General and operations managers | 626 | 1358 | 1037 | 250 | |
Marketing and sales managers | 518 | 1745 | 1142 | 403 | |
Administrative services managers | 101 | 1398 | 952 | 71 | |
Computer and information systems managers | 443 | 1756 | 1680 | 150 | |
Financial managers | 527 | 1670 | 1157 | 578 | |
Human resources managers | 73 | 1737 | 1283 | 190 | |
Industrial production managers | 201 | 1409 | 1219 | 66 | |
Purchasing managers | 95 | 1400 | 1169 | 92 | |
Transportation storage and distribution managers | 237 | 990 | 988 | 51 | |
Education administrators | 297 | 1528 | 1280 | 541 | |
Food service managers | 410 | 853 | 632 | 350 | |
Lodging managers | 59 | 1068 | 764 | 64 | |
Medical and health services managers | 133 | 1610 | 1254 | 399 | |
Real estate managers | 181 | 1157 | 815 | 221 | |
Social/community service managers | 115 | 1206 | 992 | 248 | |
Managers - all other | 1845 | 1542 | 1188 | 1115 | |
Wholesale and retail buyers | 68 | 942 | 765 | 83 | |
Purchasing agents | 128 | 1037 | 974 | 125 | |
Adjusters appraisers examiners | 114 | 1139 | 912 | 206 | |
Compliance officers | 106 | 1274 | 1163 | 146 | |
Human resources workers | 166 | 1364 | 1089 | 465 | |
Management analysts | 332 | 1586 | 1342 | 253 | |
Market research analysts | 116 | 1345 | 1097 | 130 | |
Business operations - all other | 110 | 1263 | 1001 | 146 | |
Accountants and auditors | 559 | 1441 | 1018 | 892 | |
Financial analysts | 173 | 1747 | 1252 | 104 | |
Personal financial advisors | 258 | 1714 | 953 | 142 | |
Credit counselors and loan officers | 151 | 1331 | 926 | 200 | |
Computer systems analysts | 314 | 1475 | 1328 | 182 | |
Computer programmers | 300 | 1466 | 1312 | 104 | |
Software developers/systems software | 1084 | 1863 | 1553 | 266 | |
Computer support specialists | 367 | 1078 | 1014 | 124 | |
Computer occupations all other | 418 | 1244 | 1055 | 106 | |
Operations research analysts | 59 | 1382 | 1300 | 66 | |
Engineers all other | 430 | 1659 | 1401 | 63 | |
Engineering technicians | 275 | 1075 | 793 | 75 | |
Medical scientists | 69 | 1250 | 1169 | 57 | |
Physical scientists - all other | 131 | 1727 | 1323 | 111 | |
Life physical and social science | 62 | 949 | 826 | 57 | |
Counselors | 184 | 892 | 907 | 473 | |
Social workers | 127 | 1039 | 884 | 557 | |
Clergy | 315 | 1070 | 893 | 53 | |
Lawyers | 446 | 2086 | 1619 | 299 | |
Postsecondary teachers | 535 | 1356 | 1152 | 445 | |
Elementary/middle school teachers | 605 | 1126 | 981 | 2231 | |
Secondary school teachers | 403 | 1146 | 1074 | 562 | |
Other teachers and instructors | 156 | 1135 | 786 | 214 | |
Teacher assistants | 56 | 501 | 525 | 532 | |
Designers | 290 | 1267 | 922 | 297 | |
Producers and directors | 78 | 1228 | 1030 | 50 | |
Editors | 64 | 1112 | 1035 | 56 | |
Pharmacists | 89 | 2096 | 1839 | 133 | |
Physicians and surgeons | 497 | 2343 | 1476 | 308 | |
Physical therapists | 69 | 1348 | 1306 | 128 | |
Registered nurses | 285 | 1261 | 1143 | 2213 | |
Clinical lab tech | 97 | 1071 | 834 | 198 | |
Diagnostic related tech | 79 | 1156 | 936 | 175 | |
EMT and paramedics | 114 | 821 | 650 | 60 | |
Health practitioner support tech | 113 | 712 | 643 | 361 | |
Nursing psychiatric and home health aides | 194 | 534 | 498 | 1192 | |
Bailiffs correctional officers and jailers | 275 | 793 | 672 | 91 | |
Police and sheriff's patrol officers | 609 | 1008 | 938 | 100 | |
Security guards/surveillance officers | 576 | 597 | 516 | 152 | |
Chefs and head cooks | 288 | 632 | 519 | 68 | |
Food Prep Supervisors | 174 | 666 | 485 | 251 | |
Cooks | 892 | 459 | 421 | 515 | |
Food preparation workers | 215 | 432 | 413 | 262 | |
Bartenders | 131 | 701 | 498 | 122 | |
Food preparation and Servers | 72 | 381 | 402 | 125 | |
Waiters and waitresses | 342 | 504 | 441 | 607 | |
Dining attendants | 82 | 465 | 407 | 51 | |
Housekeeping supervisors | 119 | 702 | 524 | 71 | |
Janitors | 1139 | 564 | 476 | 441 | |
Maids | 120 | 497 | 427 | 661 | |
Gaming supervisors | 68 | 840 | 717 | 59 | |
Personal care aides | 125 | 514 | 469 | 636 | |
Recreation and fitness workers | 92 | 668 | 517 | 100 | |
Retail sales supervisors | 1321 | 857 | 630 | 1047 | |
Non-retail sales supervisors | 552 | 1161 | 1004 | 230 | |
Cashiers | 402 | 475 | 403 | 965 | |
Retail salespersons | 1103 | 730 | 514 | 728 | |
Advertising sales agents | 122 | 1034 | 999 | 81 | |
Insurance sales agents | 218 | 1166 | 676 | 205 | |
Financial service agents | 155 | 1458 | 951 | 63 | |
Sales reps - all other | 282 | 1202 | 826 | 145 | |
Sales - wholesale and manufacturing | 819 | 1140 | 872 | 302 | |
Real estate brokers and sales agents | 209 | 1222 | 780 | 284 | |
Sales and related workers all other | 103 | 946 | 709 | 68 | |
Office supervisors | 383 | 942 | 809 | 819 | |
Accountants | 115 | 790 | 716 | 641 | |
Customer service | 664 | 676 | 623 | 1185 | |
Receptionists | 103 | 600 | 581 | 848 | |
Dispatchers | 126 | 734 | 671 | 153 | |
Postal service clerks | 58 | 999 | 805 | 53 | |
Postal service carriers | 185 | 1020 | 931 | 119 | |
Production planning and expediting clerks | 113 | 935 | 765 | 111 | |
Shipping receiving and traffic clerks | 322 | 602 | 583 | 151 | |
Stock clerks and order fillers | 643 | 533 | 526 | 371 | |
Secretaries and administrative assistants | 133 | 831 | 708 | 2078 | |
Data entry | 51 | 655 | 630 | 170 | |
Office clerks general | 140 | 707 | 648 | 760 | |
Office and administrative support | 107 | 855 | 751 | 351 | |
Miscellaneous agricultural workers | 547 | 524 | 423 | 111 | |
Production and operations supervisors | 599 | 972 | 723 | 131 | |
Electrical electronics and electromechanical assemblers | 55 | 618 | 554 | 50 | |
Miscellaneous assemblers and fabricators | 645 | 625 | 559 | 345 | |
Bakers | 55 | 562 | 480 | 83 | |
Butchers and other meat poultry and fish processing workers | 183 | 571 | 449 | 61 | |
Laundry and dry-cleaning workers | 55 | 486 | 436 | 80 | |
Sewing machine operators | 52 | 407 | 452 | 114 | |
Inspectors testers sorters samplers and weighers | 445 | 834 | 584 | 241 | |
Packaging and filling machine operators and tenders | 112 | 574 | 425 | 113 | |
Production workers all other | 641 | 690 | 515 | 246 | |
Bus drivers | 197 | 691 | 589 | 146 | |
Driver/sales workers and truck drivers | 2689 | 787 | 630 | 120 | |
Industrial truck and tractor operators | 510 | 604 | 563 | 54 | |
Laborers | 1196 | 580 | 509 | 221 | |
Packers and packagers | 166 | 468 | 437 | 216 |
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> | |
<meta charset="utf-8"> | |
<style> | |
svg | |
{ | |
font: 10px sans-serif; | |
padding: 10px; | |
} | |
.axis, | |
.frame | |
{ | |
shape-rendering: crispEdges; | |
} | |
.axis line | |
{ | |
stroke: #ddd; | |
} | |
.axis path | |
{ | |
display: none; | |
} | |
.cell text | |
{ | |
font-weight: bold; | |
text-transform: capitalize; | |
} | |
.frame | |
{ | |
fill: none; | |
stroke: #aaa; | |
} | |
.tooltip { | |
position: absolute; | |
width: 200px; | |
height: 75px; | |
background: white; | |
} | |
circle | |
{ | |
fill-opacity: 0; | |
} | |
circle.hidden | |
{ | |
fill: #ccc !important; | |
} | |
.extent | |
{ | |
fill: #000; | |
fill-opacity: .125; | |
stroke: #fff; | |
} | |
</style> | |
<body> | |
<script src="https://d3js.org/d3.v3.min.js"></script> | |
<script> | |
var width = 960, | |
size = 110, | |
padding = 20; | |
var x = d3.scale.linear() | |
.range([padding / 2, size - padding / 2]); | |
var y = d3.scale.linear() | |
.range([size - padding / 2, padding / 2]); | |
var xAxis = d3.svg.axis() | |
.scale(x) | |
.orient("bottom") | |
.ticks(5) | |
.tickFormat(function(d, i) | |
{ | |
return d/1000 + "k"; | |
}); | |
var yAxis = d3.svg.axis() | |
.scale(y) | |
.orient("left") | |
.ticks(5) | |
.tickFormat(function(d, i) | |
{ | |
return d/1000 + "k"; | |
}); | |
d3.csv("DataFinal.csv", function(error, data) | |
{ | |
if (error) throw error; | |
var domainPerField = {}, | |
field = d3.keys(data[0]).filter(function(d) { return d !== "Occupation"; }), | |
n = field.length; | |
field.forEach(function(field1) | |
{ | |
domainPerField[field1] = d3.extent(data, function(d) { return +d[field1]; }); | |
}); | |
xAxis.tickSize(size * n); | |
yAxis.tickSize(-size * n); | |
var svg = d3.select("body").append("svg") | |
.attr("width", size * n + padding) | |
.attr("height", size * n + padding) | |
.append("g") | |
.attr("transform", "translate(" + padding + "," + padding / 2 + ")"); | |
var tooltip = d3.select("body").append("div") | |
.attr("class", "tooltip") | |
.style("opacity", 0); | |
svg.selectAll(".x.axis") | |
.data(field) | |
.enter().append("g") | |
.attr("class", "x axis") | |
.attr("transform", function(d, i) { return "translate(" + (n - i - 1) * size + ",0)"; }) | |
.each(function(d) { x.domain(domainPerField[d]); d3.select(this).call(xAxis); }); | |
svg.selectAll(".y.axis") | |
.data(field) | |
.enter().append("g") | |
.attr("class", "y axis") | |
.attr("transform", function(d, i) { return "translate(0," + i * size + ")"; }) | |
.each(function(d) { y.domain(domainPerField[d]); d3.select(this).call(yAxis); }); | |
var cell = svg.selectAll(".cell") | |
.data(cross(field, field)) | |
.enter() | |
.append("g") | |
.attr("class", "cell") | |
.attr("transform", function(d) | |
{ | |
return "translate(" + (n - d.i - 1) * size + "," + d.j * size + ")"; | |
}) | |
.each(plot); | |
// Titles for the diagonal. | |
cell.filter(function(d){ return d.i === d.j;}) | |
.append("text") | |
.attr("x", padding) | |
.attr("dx", "-1.01em") | |
.attr("y", padding) | |
.attr("dy", "-1.2em") | |
.text(function(d) | |
{ | |
if(d.x === "earningsMen") | |
{ | |
return "Median Mens Earning (Weekly)"; | |
} | |
else if(d.x === "earningsWomen") | |
{ | |
return "Median Womens Earning (Weekly)"; | |
} | |
else if(d.x === "earningsTotal") | |
{ | |
return "Median Total Earnings (Weekly)"; | |
} | |
else if(d.x === "workersWomen") | |
{ | |
return "Women Workers (In Thousands)"; | |
} | |
else if(d.x === "workersMen") | |
{ | |
return "Men Workers (In Thousands)"; | |
} | |
}); | |
function plot(p) | |
{ | |
var cell = d3.select(this); | |
x.domain([0,d3.max(domainPerField[p.x])+100]); | |
y.domain([0,d3.max(domainPerField[p.y])+100]); | |
cell.append("rect") | |
.attr("class", "frame") | |
.attr("x", padding / 2) | |
.attr("y", padding / 2) | |
.attr("width", size - padding) | |
.attr("height", size - padding); | |
cell.selectAll("circle") | |
.data(data) | |
.enter() | |
.append("circle") | |
.attr("cx", function(d) { return x(d[p.x]); }) | |
.attr("cy", function(d) { return y(d[p.y]); }) | |
.attr("r", 2) | |
.style("stroke", function(d) | |
{ | |
if(p.y === "workersMen") | |
{ | |
var colorScale = d3.scale.linear() | |
.domain([51, 1869]) | |
.range(["#b3ffb3","#003300"]); | |
return colorScale(+d[p.y]); | |
} | |
else if(p.y === "workersTotal") | |
{ | |
var colorScale = d3.scale.linear() | |
.domain([105, 2960]) | |
.range(["#b3ffb3","#003300"]); | |
return colorScale(+d[p.y]); | |
} | |
else if(p.y === "earningsMen") | |
{ | |
var colorScale = d3.scale.linear() | |
.domain([407, 2419]) | |
.range(["#b3ffb3","#003300"]); | |
return colorScale(+d[p.y]); | |
} | |
else if(p.y === "earningsTotal") | |
{ | |
var colorScale = d3.scale.linear() | |
.domain([414, 2303]) | |
.range(["#b3ffb3","#003300"]); | |
return colorScale(+d[p.y]); | |
} | |
else if(p.y === "workersWomen") | |
{ | |
var colorScale = d3.scale.linear() | |
.domain([51, 2231]) | |
.range(["#b3ffb3","#003300"]); | |
return colorScale(+d[p.y]); | |
} | |
else if(p.y === "earningsWomen") | |
{ | |
var colorScale = d3.scale.linear() | |
.domain([403, 1876]) | |
.range(["#b3ffb3","#003300"]); | |
return colorScale(+d[p.y]); | |
} | |
else | |
{ | |
var colorScale = d3.scale.linear() | |
.domain([.405, .79]) | |
.range(["#b3ffb3","#003300"]); | |
return colorScale(+d[p.y]); | |
} | |
}) | |
.on("mouseover", function(d) { | |
var y; | |
var x; | |
if(p.y === "workersMen") | |
{ | |
y = "Men Workers (thousands): " | |
} | |
else if(p.y === "workersWomen") | |
{ | |
y = "Women Workers (thousands): " | |
} | |
else if(p.y === "earningsWomen") | |
{ | |
y = "Average Women Earning: " | |
} | |
else if(p.y === "earningsMen") | |
{ | |
y = "Average Men Earning: " | |
} | |
else if(p.y === "earningsTotal") | |
{ | |
y = "Average Overall Earning: " | |
} | |
if(p.x === "workersMen") | |
{ | |
x = "Men Workers (thousands): " | |
} | |
else if(p.x === "workersWomen") | |
{ | |
x = "Women Workers (thousands): " | |
} | |
else if(p.x === "earningsWomen") | |
{ | |
x = "Average Women Earning: " | |
} | |
else if(p.x === "earningsMen") | |
{ | |
x = "Average Men Earning: " | |
} | |
else if(p.x === "earningsTotal") | |
{ | |
x = "Average Overall Earning: " | |
} | |
tooltip.transition() | |
.duration(200) | |
.style("opacity", .9); | |
tooltip.html(d.Occupation + "<br/>" + | |
y +d[p.y] | |
+ "<br/> "+ x +d[p.x]) | |
.style("left", (d3.event.pageX + 5) + "px") | |
.style("top", (d3.event.pageY - 28) + "px"); | |
}) | |
.on("mouseout", function(d) { | |
tooltip.transition() | |
.duration(500) | |
.style("opacity", 0); | |
}); | |
; | |
} | |
}); | |
function cross(a, b) | |
{ | |
var c = [], n = a.length, m = b.length, i, j; | |
for (i = -1; ++i < n;) for (j = -1; ++j < m;) | |
{ | |
c.push({x: a[i], i: i, y: b[j], j: j}); | |
} | |
return c; | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment