Unlisted
Edited
May 10, 2023
Insert cell
Insert cell
data =[
{name: 'run' ,
data: [{time: 0, rank: 0}, {time:1, rank:1}, {time:2, rank:2}, {time:3, rank:3}]
},
{name: 'walk' ,
data: [{time: 2, rank: 0}, {time:3, rank:1}, {time:4, rank:2}, {time:5, rank:3}]
},
{name: 'float' ,
data: [{time: 6, rank: 0}, {time:5, rank:1}, {time:6, rank:2}, {time:7, rank:3}]
}
]
Insert cell
flatData = data.flatMap((d) => d.data.map((e) => ({ name: d.name, ...e })))
Insert cell
Plot.plot({
marks: [
Plot.ruleY([0]),
Plot.lineY(flatData, {x: "time", y: "rank", stroke: "name"})
]
})
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