Public
Edited
Aug 23, 2023
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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more