/
industry_academia.html
executable file
·527 lines (451 loc) · 18.8 KB
/
industry_academia.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<script src='//d3js.org/d3.v4.js'></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Paid Parental Leave in Academic CS and Tech</title>
</head>
<style type="text/css">
div.tooltip {
position: absolute;
text-align: left;
padding: 4px;
font: 12px sans-serif;
background: #eee;
}
body {
font-family: "Helvetica";
font-size: 12px;
width: 590px;
padding-left: 20px;
padding-right: 20px;
}
h2 {
font-weight: 100;
font-size: 2em;
}
h3 {
margin-top: 0px;
}
h4 {
font-size: 1.25em;
display: inline;
clear: none;
padding-right: 0.5em;
}
#controls {
padding-top: 10px;
}
form {
display: inline-block;
}
.legend_item {
font-size: 1.3em;
}
a {
color: #3983D6;
font-weight: bold;
text-decoration: none;
}
a:hover {
color: #202020;
}
</style>
<body>
<h2>Paid Parental Leave in Academic CS and in Tech</h2>
<p>Inspired in part by a study of university parental leave policies by <a href="https://docs.google.com/viewer?a=v&pid=sites&srcid=ZGVmYXVsdGRvbWFpbnxzdGVhcm5zamV8Z3g6NDE0NTM4MTBhYjBmYjhmYw">Antecol et al.</a> (<a href="https://www.nytimes.com/2016/06/26/business/tenure-extension-policies-that-put-women-at-a-disadvantage.html">New York Times</a>, <a href="https://www.insidehighered.com/news/2016/06/27/stopping-tenure-clock-may-help-male-professors-more-female-study-finds">Inside HigherEd</a>), we<sup>1</sup> recently collected the paid parental leave policies for tenure-track faculty at 205 research universities with PhD-granting Computer Science departments in the US and Canada. Our methods and data are available <a href="https://aaronclauset.github.io/parental-leave/">here</a>.</p>
<p>How do academic policies compare to those of companies in the tech industry? Thanks to a tip from <a href="https://ipk.nyu.edu/people/laura-noren/">Laura Noren</a>, we obtained <a href="https://docs.google.com/spreadsheets/d/1GKWqhc3FVtSVKRZNBxyfwZ_QrB1f-i1T0-yBJ6X_YHM/edit">a dataset</a> of paid parental leave policies for roughly 100 tech companies, crowdsourced by tech employees and community members after being started by Aaron Harnly of Amplify. To compare the two sets of policies, we merged the new data with ours to produce the visualization below.</p>
<p>Each data point represents the amount of paid parental leave provided by a university or a tech company. Hover over a data point to see more details on that policy, including its primary source. If you find an error or want to add a policy, you can <a href="https://docs.google.com/spreadsheets/d/1GKWqhc3FVtSVKRZNBxyfwZ_QrB1f-i1T0-yBJ6X_YHM/edit">add or correct industry data</a>, or <a href="https://goo.gl/forms/uZAVXaqRGpF3AjNS2">add or correct</a> academic data.</p>
<p>1. A project by Allison Morgan, Sam Way, Mirta Galesic, Aaron Clauset, and Dan Larremore at the University of Colorado Boulder and the Santa Fe Institute. You can find more about us <a href="https://aaronclauset.github.io/parental-leave#about">here</a>.</p>
<div id="controls">
<p>
<h4 class="title">Sort by: </h4>
<button type="button" onclick="rearrange('sorted_by_name')">Name</button>
<button type="button" onclick="rearrange('sorted_by_women')">Women's Leave</button>
<button type="button" onclick="rearrange('sorted_by_men')">Men's Leave</button>
</p>
<p id="color_legend">
<h4 class="title">Colors:</h4>
<span class="legend_item" style="color: #3983D6;">Tech</span>,
<span class="legend_item" style="color: #202020;">Academia</span>
</p>
</div>
<h3></h3>
<!-- Begin D3 Javascript -->
<script type="text/javascript">
// Globals
var TEXT_POS = 175;
var TEXT_PAD = 10;
var DEFAULT_F_COLOR = "#67C080";
var DEFAULT_M_COLOR = "#202020";
var PRIVATE_COLOR = "#B074E8"
var PUBLIC_COLOR = "#202020";
var REGION_COLORS = { "Midwest": "#AB4ADB",
"Northeast": "#077187",
"South": "#CCA43B",
"West": "#5BBA6F",
"Canada": "#DB3A34"};
var DEFAULT_MARKER_COLOR = "#999999";
var INDUSTRY_COLOR = "#3983D6";
var TRANSITION_DURATION = 1000;
// Setup data
var tsvdata = [];
var loaded = 0;
var sortby = "sorted_by_name";
// Setup settings for graphic
var canvas_width = 550;
var canvas_height = 3000;
var yPadding = 60;
var xPadding = 200;
var xScale;
var yScale;
var shapes;
var texts;
var xticks = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50];
// Presorting function
function presort_by(data, by, name, isNumeric)
{
// Default to alphabetical if values are the same.
var to_sort = []
if (isNumeric) {
for (var i = 0; i < data.length; i++)
{ to_sort.push([parseFloat(data[i][by]), i, data[i]["short_name"]]);}
to_sort.sort(function(left, right) {
if (left[0] != right[0])
return left[0] > right[0] ? -1 : 1;
else
return left[2] < right[2] ? -1 : 1; });
}
else {
for (var i = 0; i < data.length; i++)
{ to_sort.push([data[i][by], i, data[i]["short_name"]]); }
to_sort.sort(function(left, right) {
if (left[0] != right[0])
return left[0] < right[0] ? -1 : 1;
else
return left[2] < right[2] ? -1 : 1; });
}
// Fill in sorted and SCALED values
for (i=0; i<data.length; i++) {
data[to_sort[i][1]][name] = yScale(i);
}
return;
}
// Tooltip functions
function make_tooltip(d) {
var source_link;
if ("link" in d && d.link.includes("http"))
source_link = "<br />[<a target='_blank' href='" + d.link + "'>source</a>]";
else
source_link = "";
div.transition()
.duration(200)
.style("opacity", .9);
div .html("<span class='title'>" + d.short_name + "</span>"
+ "<br />Women: " + d.paid_leave_weeks_woman + " weeks"
+ "<br />Men: " + d.paid_leave_weeks_man + " weeks"
+ source_link)
.style("left", (d3.event.pageX + 10) + "px")
.style("top", (d3.event.pageY - 28) + "px");
}
function hide_tooltip(d) {
div.transition()
.duration(500)
.delay(1000)
.style("opacity", 0);
}
// Create SVG element
var svg = d3.select("h3")
.append("svg")
.attr("width", canvas_width)
.attr("height", canvas_height)
// Tooltip
var div = d3.select("body").append("div")
.attr("class", "tooltip")
.style("opacity", 0);
// Load data and build the figure
d3.tsv("parental_leave_policies.tsv", function(data) {
// Only show universities where we found a policy
data = data.filter(function(entry) { return entry.missing == 0; });
for (var i = 0; i < data.length; i++) {
data[i].f_color = DEFAULT_M_COLOR;
data[i].m_color = DEFAULT_M_COLOR;
}
loaded += 1;
tsvdata = tsvdata.concat(data);
build_vis();
});
// Load data and build the figure
d3.tsv("tech.tsv", function(data) {
for (var i=0; i<data.length; i++)
{
data[i].f_color = INDUSTRY_COLOR;
data[i].m_color = INDUSTRY_COLOR;
data[i].link = "https://docs.google.com/spreadsheets/d/1GKWqhc3FVtSVKRZNBxyfwZ_QrB1f-i1T0-yBJ6X_YHM/edit#gid=0";
data[i].short_name = data[i]["Company (Don’t see yours? Add it!)"];
data[i].paid_leave_weeks_woman = data[i]["# weeks fully paid Maternity/primary"];
data[i].paid_leave_weeks_man = data[i]["# weeks fully paid Paternity/nonprimary"];
}
loaded += 1;
tsvdata = tsvdata.concat(data);
build_vis();
});
function build_vis() {
if (loaded < 2) return;
// Create scale functions
xScale = d3.scaleLinear()
.domain([0, 55])
.range([TEXT_POS+TEXT_PAD, canvas_width]);
yScale = d3.scaleLinear()
.domain([0, tsvdata.length])
.range([yPadding, canvas_height - yPadding/2]);
// Pre-calculate sorted indicies
presort_by(tsvdata, "paid_leave_weeks_woman", "sorted_by_women", true)
presort_by(tsvdata, "paid_leave_weeks_man", "sorted_by_men", true)
presort_by(tsvdata, "short_name", "sorted_by_name", false)
// Custom grid
for (i=0; i<xticks.length; i++)
{
svg.append("line")
.style("stroke", "gray")
.style("stroke-dasharray", ("1, 3"))
.attr("stroke-width", ".5")
.attr("x1", xScale(xticks[i]))
.attr("x2", xScale(xticks[i]))
.attr("y1", yScale(0) - 15)
.attr("y2", yScale(tsvdata.length));
svg.append("text")
.attr("color", DEFAULT_M_COLOR)
.attr("x", xScale(xticks[i]))
.attr("y", yScale(0) - 20)
.attr("font-weight", 100)
.attr("text-anchor", "middle")
.attr("font-size", "14px")
.text(xticks[i]);
svg.append("text")
.attr("color", DEFAULT_M_COLOR)
.attr("x", xScale(xticks[i]))
.attr("y", yScale(tsvdata.length + 2))
.attr("font-weight", 100)
.attr("text-anchor", "middle")
.attr("font-size", "14px")
.text(xticks[i]);
}
// Title and legend
svg.append("text")
.attr("x", xScale(0))
.attr("y", yScale(0) - 45)
.attr("color", DEFAULT_M_COLOR)
.attr("font-weight", 100)
.attr("text-anchor", "start")
.attr("font-size", "16px")
.text("Paid Leave Duration (weeks)");
svg.append("circle")
.attr("class", "f_marker")
.attr("cx", xScale(35))
.attr("cy", yScale(0) - 50)
.attr("fill", "#fff")
.attr("stroke", DEFAULT_MARKER_COLOR)
.attr("stroke-width", "2")
.attr("r", 3.5);
svg.append("text")
.attr("x", xScale(36))
.attr("y", yScale(0) - 45)
.attr("font-weight", 100)
.attr("text-anchor", "start")
.attr("font-size", "14px")
.attr("color", DEFAULT_M_COLOR)
.text("Women");
svg.append("line")
.attr("class", "m_marker")
.attr("stroke", DEFAULT_MARKER_COLOR)
.attr("stroke-width", "1.25")
.attr("x1", xScale(45)-3)
.attr("x2", xScale(45)+3)
.attr("y1", yScale(0)-50-3)
.attr("y2", yScale(0)-50+3);
svg.append("line")
.attr("class", "m_marker")
.attr("stroke", DEFAULT_MARKER_COLOR)
.attr("stroke-width", "1.25")
.attr("x1", xScale(45)-3)
.attr("x2", xScale(45)+3)
.attr("y1", yScale(0)-50+3)
.attr("y2", yScale(0)-50-3);
svg.append("text")
.attr("x", xScale(46))
.attr("y", yScale(0) - 45)
.attr("font-weight", 100)
.attr("text-anchor", "start")
.attr("font-size", "14px")
.attr("color", DEFAULT_M_COLOR)
.text("Men");
// Create all of our markers
shapes = svg.selectAll(".shapes").data(tsvdata).enter();
// Line connecting the two markers
shapes.append("line")
.style("stroke", "gray")
.attr("stroke-width", ".5")
.attr("class", "linesc movey")
.attr("x1", function(d, i) { return xScale(d.paid_leave_weeks_man); })
.attr("x2", function(d, i) { return xScale(d.paid_leave_weeks_woman); })
.attr("y1", function(d, i) { return d[sortby]; })
.attr("y2", function(d, i) { return d[sortby]; });
// Women (circles)
shapes.append("circle")
.attr("cx", function(d, i) { return xScale(d.paid_leave_weeks_woman); })
.attr("cy", function(d, i) { return d[sortby]; })
.attr("fill", "#fff")
.attr("stroke", function(d, i) { return d.f_color; })
.attr("stroke-width", "2")
.attr("r", 3.5)
.attr("class", "dots movey")
.on("mouseover", function(d) { make_tooltip(d); })
.on("mouseout", function(d) { hide_tooltip(d); });
// Men (draw X as two lines)
shapes.append("line")
.attr("stroke", function(d, i) { return d.m_color; })
.attr("stroke-width", "1.25")
.attr("class", "x1")
.on("mouseover", function(d) { make_tooltip(d); })
.on("mouseout", function(d) { hide_tooltip(d); })
.attr("x1", function(d, i) { return xScale(d.paid_leave_weeks_man)-3; })
.attr("x2", function(d, i) { return xScale(d.paid_leave_weeks_man)+3; })
.attr("y1", function(d, i) { return d[sortby]-3; })
.attr("y2", function(d, i) { return d[sortby]+3; });
shapes.append("line")
.attr("stroke", function(d, i) { return d.m_color; })
.attr("stroke-width", "1.25")
.attr("class", "x2")
.on("mouseover", function(d) { make_tooltip(d); })
.on("mouseout", function(d) { hide_tooltip(d); })
.attr("x1", function(d, i) { return xScale(d.paid_leave_weeks_man)-3; })
.attr("x2", function(d, i) { return xScale(d.paid_leave_weeks_man)+3; })
.attr("y1", function(d, i) { return d[sortby]+3; })
.attr("y2", function(d, i) { return d[sortby]-3; });
// University labels
texts = shapes.append("text")
.attr("class", "names movey")
.attr("color", function(d) { return d.m_color; })
.attr("x", function(d, i) { return TEXT_POS; })
.attr("y", function(d, i) { return d[sortby]; })
.text(function(d) { return d.short_name; })
.attr("font-weight", "100")
.attr("alignment-baseline", "central")
.attr("text-anchor", "end")
.attr("font-size", "11px");
}
function rearrange(by, force_update = false) {
// Bail if no changes needed
if (sortby == by && !force_update) { return; }
// Update sorting variable
sortby = by;
// Update female markers...
svg.selectAll(".dots")
.transition()
.duration(TRANSITION_DURATION)
.delay(function(d, i) { return i / tsvdata.length * 500; })
.attr("stroke", function(d, i) { return d.f_color; })
.attr("cy", function(d, i) { return d[sortby]; })
// ...connecting lines...
svg.selectAll(".linesc")
.transition()
.duration(TRANSITION_DURATION)
.delay(function(d, i) { return i / tsvdata.length * 500; })
.attr("y1", function(d, i) { return d[sortby]; })
.attr("y2", function(d, i) { return d[sortby]; });
// ...male markers...
svg.selectAll(".x1")
.transition()
.duration(TRANSITION_DURATION)
.delay(function(d, i) { return i / tsvdata.length * 500; })
.attr("stroke", function(d, i) { return d.m_color; })
.attr("y1", function(d, i) { return d[sortby]-3; })
.attr("y2", function(d, i) { return d[sortby]+3; });
svg.selectAll(".x2")
.transition()
.duration(TRANSITION_DURATION)
.delay(function(d, i) { return i / tsvdata.length * 500; })
.attr("stroke", function(d, i) { return d.m_color; })
.attr("y1", function(d, i) { return d[sortby]+3; })
.attr("y2", function(d, i) { return d[sortby]-3; });
// ...and names of the universities.
svg.selectAll(".names")
.transition()
.duration(TRANSITION_DURATION)
.delay(function(d, i) { return i / tsvdata.length * 500; })
.style('fill', function(d, i) { return d.m_color; } )
.attr("y", function(d, i) { return d[sortby]; });
}
// Radio button controls (for selecting coloring options)
d3.selectAll("input[name='highlight']").on("change",
function() {
// For updating the legend
var f_marker_color = DEFAULT_MARKER_COLOR;
var m_marker_color = DEFAULT_MARKER_COLOR;
// If coloring by public/private status
if (this.value == "pubpriv")
{
for (var i=0; i<tsvdata.length; i++){
if (tsvdata[i].is_private == 1)
{
tsvdata[i].f_color = PRIVATE_COLOR;
tsvdata[i].m_color = PRIVATE_COLOR;
}
else
{
tsvdata[i].f_color = PUBLIC_COLOR;
tsvdata[i].m_color = PUBLIC_COLOR;
}
}
svg.selectAll(".pubpriv_legend").attr("opacity", "100%");
svg.selectAll(".loc_legend").attr("opacity", "0");
document.getElementById('color_legend').innerHTML = `
<h4 class="title">Colors:</h4>
<span class="legend_item" style="color: #202020;">Public</span>,
<span class="legend_item" style="color: #B074E8;"> Private</span>
`;
}
// If coloring by region
else if (this.value == "loc")
{
for (var i=0; i<tsvdata.length; i++){
color = REGION_COLORS[tsvdata[i].census_region];
tsvdata[i].f_color = color;
tsvdata[i].m_color = color;
}
svg.selectAll(".pubpriv_legend").attr("opacity", "0");
svg.selectAll(".loc_legend").attr("opacity", "100%");
document.getElementById('color_legend').innerHTML = `
<h4 class="title">Colors:</h4>
<span class="legend_item" style="color: #077187;">Northeast</span>,
<span class="legend_item" style="color: #CCA43B;"> South</span>,
<span class="legend_item" style="color: #AB4ADB;"> Midwest</span>,
<span class="legend_item" style="color: #5BBA6F;"> West</span>,
<span class="legend_item" style="color: #DB3A34;"> Canada</span>
`;
}
// If using default colors
else
{
for (var i=0; i<tsvdata.length; i++){
tsvdata[i].f_color = DEFAULT_F_COLOR;
tsvdata[i].m_color = DEFAULT_M_COLOR;
}
f_marker_color = DEFAULT_F_COLOR;
m_marker_color = DEFAULT_M_COLOR;
svg.selectAll(".pubpriv_legend").attr("opacity", "0");
svg.selectAll(".loc_legend").attr("opacity", "0");
document.getElementById('color_legend').innerHTML = ``;
}
// Update the legend colors
svg.selectAll(".f_marker").attr("stroke", f_marker_color);
svg.selectAll(".m_marker").attr("stroke", m_marker_color);;
// Force redraw.
rearrange(sortby, true);
});
</script>
</body>
</html>