Public
Edited
May 28, 2023
1 star
Insert cell
Insert cell
Plot.plot({
marginTop: 40,
x: { type: "band", nice: true },
color: { type: "ordinal" },
fx: { axis: null },
facet: {
data: data,
x: "category"
},
marks: [
Plot.barY(data, { x: "x", y: "y", fill: "x" }),
Plot.text(
data,
Plot.selectMaxY({
fontSize: "18pt",
text: "category",
// x: "x",
y: "y",
lineAnchor: "bottom",
dy: -12
})
)
]
})
Insert cell
data = [
{category: "Age 20-50", x: "2023-01-01", y: 100},
{category: "Age 20-50", x: "2023-02-01", y: 125},
{category: "Age 50-90", x: "2023-01-01", y: 133},
{category: "Age 50-90", x: "2023-02-01", y: 168},
]
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