Public
Edited
Feb 14, 2024
Paused
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
paper_dat_multi
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
db = DuckDBClient.of({ timeline: FileAttachment("timeline_prod@19.json") })
Insert cell
uniqAuthors = db.query(`SELECT DISTINCT(target) FROM timeline ORDER BY target`)
Insert cell
selected_targets = form.targets.length > 0 ? form.targets : ['Laurent Hébert‐Dufresne']
Insert cell
paper_dat_multi = db.query(`SELECT * FROM timeline WHERE target in (${selected_targets.map(d => '\''+d+'\'').join()})`)
Insert cell
count_author_pos = db.query(`
SELECT COUNT(target_position) as n, target_position, ${form.yaxis}, target
FROM timeline
WHERE target in (${selected_targets.map(d => '\''+d+'\'').join()}) and type = 'paper'
GROUP BY target_position, ${form.yaxis}, target
`)
Insert cell
p_r = (d) => {
// Determines paper node size
switch (form.p_r) {
case 'nb_coauthor':
return d.author === null ? 0 : d.author.split(", ").length;
case '':
return 1;
case 'cited_by_count':
return d['cited_by_count'];
}
}
Insert cell
function getLastWord(str) {
let words = str.split(" ");
return words[words.length - 1];
}

Insert cell
parseYear = d3.utcParse("%Y")
Insert cell
parseTime = d3.utcParse("%Y-%m-%d")
Insert cell
count_coauthor = db.query(`
SELECT COUNT(title) as n, title as coauthor
FROM timeline
WHERE target = 'Jean-Gabriel Young' and type == 'coauthor'
GROUP BY target, title
order by coauthor
`)
Insert cell
count_coauthor
Insert cell
Plot.plot({
marginLeft: 70,
marks: [
Plot.rectY(count_coauthor, Plot.binX({y: "count"}, {x: "n"})),
Plot.ruleY([0])
]
})
Insert cell
countPapers = db.query(`
SELECT COUNT(pub_year) as n, target, pub_year
FROM timeline
WHERE type == 'paper'
GROUP BY (pub_year, target)
`)
Insert cell
Plot.plot({
marks: [
Plot.rectY(countPapers, Plot.binX({y: "count"}, {x: "n"})),
Plot.ruleY([0])
]
})
Insert cell
Plot.plot({
marks: [
Plot.rectY(countPapers, Plot.binX({y: "count"}, {x: "n"})),
Plot.ruleY([0])
]
})
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more