Public
Edited
Sep 23, 2024
2 stars
Insert cell
Insert cell
somepenguins = penguins.slice(0, 20)
Insert cell
Insert cell
tallpenguins = ["culmen_length_mm", "culmen_depth_mm"].flatMap((measure) =>
somepenguins.map((d, i) => ({
facet: measure,
index: i,
value: d[measure]
}))
)
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.barX(tallpenguins, {x: "value", y: "index", fx: "facet", sort: {y: "-x"}}),
Plot.ruleX([0])
]
})
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.barX(tallpenguins, {
x: "value",
y: "index",
fx: "facet",
sort: {
y: "-data",
reduce: (D) => D.find((d) => d.facet === "culmen_depth_mm")?.value
}
}),
Plot.ruleX([0])
]
})
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.barX(somepenguins, {x: "culmen_depth_mm", y: Plot.indexOf, fx: () => "culmen_depth_mm", sort: {y: "-x"}}),
Plot.barX(somepenguins, {x: "culmen_length_mm", y: Plot.indexOf, fx: () => "culmen_length_mm"}),
Plot.ruleX([0])
]
})
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