Public
Edited
Dec 11, 2023
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
cars = FileAttachment("FinalDataTrim9.csv").csv({typed: true})
Insert cell
Insert cell
longitude = d3.scalePoint(new Set(Plot.valueof(points, "key")), [180, -180]).padding(0.5).align(1)
Insert cell
points = {
const points = d3.sort(cars, d => d.Price).flatMap(({ name, ...values }, i) =>
Object.entries(values).map(([key, raw]) => ({
name,
country: name.split(" ")[0],
year: name.split(" ")[1],
key,
raw,
fx: (1 + i%7) % 4, // trellis (facets); we leave facet <0,0> empty for the legend
fy: Math.floor((1 + i%7) / 4)
}))
);
for (const [, g] of d3.group(points, d => d.key)) {
const m = d3.max(g, d => d.raw);
for (const d of g) d.value = d.raw / m;
}
return points;
}
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