Public
Edited
Apr 20
Paused
2 forks
Importers
39 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
a = Array.from(A(width, height, N))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
b = Array.from(B(width, height, N))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
c = Array.from(C(width, height, N))
Insert cell
Insert cell
/*
function* D(width, height, N) {
let radius = Math.sqrt((width * height) / N) * 0.84;
const quad = d3.quadtree();
let steps = 0;
do {
const point = [rng() * width, rng() * height];
if (quad.find(...point, radius) === undefined) {
quad.add(point);
yield point;
}
} while (steps++ < 1e7);
}
*/
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
rng = Math.random // import {…} with {rng} to change the random number generator
Insert cell
N = 4000
Insert cell
height = 400
Insert cell
async function* show(z, visibility) {
await visibility();
const context = DOM.context2d(width, height);
yield context.canvas;
context.fillStyle = "rgba(20, 150, 240, 0.6)";

let i = 0;
const radius = Math.sqrt((width * height) / N / 2.5);
for (const p of z) {
context.beginPath();
context.arc(p[0], p[1], 0.65 * radius, 0, 2 * Math.PI);
context.fill();

if (i++ % 40 === 0) yield context.canvas;
}
}
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