Public
Edited
Feb 15, 2024
3 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
visualize(square, xCross, disk, triangle)
Insert cell
Insert cell
Insert cell
visualize(compute((row, col) => row === 0))
// └─ top ─┘
Insert cell
Insert cell
visualize(compute((row, col) => row === size - 1))
// └─── bottom ───┘
Insert cell
Insert cell
visualize(compute((row, col) => col === 0))
// └─ left ─┘
Insert cell
Insert cell
visualize(compute((row, col) => col === size - 1))
// └──── right ────┘
Insert cell
Insert cell
square = compute((row, col) => (col === 0 || row === 0 || col === size - 1 || row === size - 1))
Insert cell
visualize(square)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
xCross = compute((x, y) => x === y || x === size - 1 - y)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
disk = {
const center = { x: (size - 1) / 2, y: (size - 1) / 2 };
const distance = (x, y) => Math.sqrt(Math.pow(center.x - x, 2) + Math.pow(center.y - y, 2));
return compute((x, y) => distance(x, y) < size / 2);
}
Insert cell
visualize(disk)
Insert cell
Insert cell
triangle = compute((y, x) => true)
Insert cell
visualize(triangle)
Insert cell
Insert cell
Insert cell
Insert cell
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