Public
Edited
May 22, 2023
1 star
Insert cell
Insert cell
Insert cell
Plot.plot({
width: 1152,
height: 1400,
insetLeft: 40,
insetRight: 40,
r: {range: [0, 40]},
marks: [
Plot.frame({anchor:"bottom"}),
Plot.dot(
layoffs,
Plot.dodgeY(
{x: "date",
r: "laidOff",
fill: "#ebe8e8",
padding: 2,
stroke: "#000",
strokeWidth: 0.8,
title: (d) => d.company
})),
Plot.text(
layoffs,
Plot.filter(
(d) => d.laidOff > 1000,
Plot.dodgeY({
x: "date",
r: "laidOff",
fill: "#000",
stroke: "#ebe8e8",
padding: 2,
text: (d) => `${d.company}\n${d.laidOff}`,
})
)
)
]
})

Insert cell
Insert cell
layoffs = {
const data = await FileAttachment("layoffs_2_13_2023.xlsx - Sheet1.csv").csv();
return data.map((d)=> {
const company = d["Company"];
const laidOff = d["Total Laid Off"];
const date = parsedDate(d["Date"]);
const industry = d["Industry"];
const country = d["Country"];
return {company, date, laidOff, industry, country};
});
}
Insert cell
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