Published
Edited
Feb 7, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
N = 120
Insert cell
import { grid } from "@fil/gray-fuller-grid"
Insert cell
points = {
const t = performance.now();
return Object.assign(grid(N), { t: performance.now() - t });
}
Insert cell
v = {
const t = performance.now();
return Object.assign(d3.geoVoronoi(points), { t: performance.now() - t });
}
Insert cell
polygons = v.polygons()
Insert cell
Insert cell
deviation_percent = d3.deviation(areas) / median
Insert cell
maximum_percent = {
const median = d3.median(areas);
return d3.max(areas, d => Math.abs(d - median)) / median;
}
Insert cell
areas = polygons.features.slice(12).map(d3.geoArea)
Insert cell
median = d3.median(areas)
Insert cell
mean = d3.mean(areas)
Insert cell
data = areas.map(a => a / median)
Insert cell
d3.extent(data)
Insert cell
Insert cell
edgeLengths = polygons.features.slice(12).map(d3.geoLength)
Insert cell
medianLength = d3.median(edgeLengths)
Insert cell
dataLength = edgeLengths.map(d => d / medianLength)
Insert cell
deviation_percentLength = d3.deviation(edgeLengths) / medianLength
Insert cell
maximum_percentLength = d3.max(edgeLengths, d => Math.abs(d - medianLength)) /
medianLength
Insert cell
d3 = require("d3@7", "d3-geo-projection@4", "d3-geo-polygon@1.8", "d3-geo-voronoi@2")
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