Public
Edited
Jun 8, 2024
Insert cell
Insert cell
Plot.plot({
marginLeft: 60,
x: { label: "Frequency" },
y: { label: null },
color: { legend: true },
marks: [
Plot.barX(penguins, {
y: "species",
x: 1,
inset: 0.5,
fill: "body_mass_g",
sort: "body_mass_g"
}),
// Plot.text(
// penguins,
// Plot.selectLast({
// y: "species",
// x: 1,
// text: ["Foo"],
// lineAnchor: "top",
// dy: 6
// })
// ),
Plot.text(sums, {
y: "species",
x: "total",
text: "total",
lineAnchor: "middle",
textAnchor: "start",
dx: 2
}),
Plot.ruleX([0])
]
})
Insert cell
sums = [...d3.group(penguins, (d) => d.species)].map(([species, data]) => ({
species,
total: data.length
}))
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