Public
Edited
Oct 25, 2023
Insert cell
Insert cell
olympians
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
aggregate = d3.rollup(olympians, v => d3.mean(v, d => d.weight), d => d.sport)
Insert cell
sportWeight = d3.flatRollup(
olympians,
(v) => d3.mean(v, (d) => d.weight),
(d) => d.sport
)
.map(([sport, weight]) => ({ sport, weight }))
Insert cell
Plot.plot({
marks: [
Plot.barX(
sportWeight,
Plot.group(
{ x: "mean" },
{ y: "sport", x: "weight", sort: {y: "x", reverse: true} }
)
)
]
})
Insert cell
untitled = FileAttachment("2023-10-21 09.23.35.jpg").image()
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