Unlisted
Edited
Dec 1, 2022
1 fork
1 star
Insert cell
Insert cell
Plot.plot({
marginLeft: 100,
marginRight: 40,
marks: [
Plot.barX(
olympians,
Plot.groupY(
{ x: "count" },
{ y: "sport", sort: { y: "x", reverse: true } }
)
),
Plot.text(
olympians,
Plot.groupY(
{ x: "count", text: "count" },
{
frameAnchor: "left",
dx: 3,
y: "sport",
sort: { y: "x", reverse: true }
}
)
)
]
})
Insert cell
Plot.plot({
marginLeft: 100,
marginRight: 40,
marks: [
Plot.barX(olympians, groupBySport()),
Plot.text(olympians, groupBySport({text: "count"}, {frameAnchor: "left", dx: 3}))
]
})
Insert cell
function groupBySport(outputs, options) {
return Plot.groupY(
{ x: "count", ...outputs },
{ y: "sport", sort: { y: "x", reverse: true }, ...options }
);
}
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