Public
Edited
Jul 25, 2024
Insert cell
Insert cell
Insert cell
Insert cell
agesOfElectedPresidentsVoters
X
election year
Y
born
Color
#ff5375
Size
Facet X
Facet Y
Mark
dot
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
// data = agesOfElectedPresidentsVoters
data = agesOfElectedPresidentsVoters.map((p, i) => ({
i: i,
age: p.age,
born: p.born,
"election year": p["election year"],
// born: new Date(p.born, 0, 2),
// "election year": new Date(p["election year"], 0, 2),
president: p.president,
dy: p["election year"] <= 1956 ? -100 : + 50
}))
Insert cell
data
Insert cell
mean_age = d3.mean(data.map(d => d.age));
Insert cell
born_range = [1732, 1961]
Insert cell
norm_data = born_range.map(b => ({born: b, "election year": b + mean_age}))
Insert cell
ages of elected presidents, voters@1.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

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