Published
Edited
Nov 29, 2020
8 stars
Also listed in…
Color
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
distances = FileAttachment("distances.json").json()
Insert cell
N = Math.sqrt(distances.length)
Insert cell
function distance(i, j) {
return distances[i + N * j];
}
Insert cell
sleepwalkFill = d3
.scaleSequentialPow(d3.interpolateRdYlBu)
.exponent(2)
.domain([0, max])
Insert cell
import {legend as colorLegend} from "@d3/color-legend"
Insert cell
data = d3.range(N)
Insert cell
config = ({
nComponents: 2,
minDist: 0.25,
nNeighbors: 35
})
Insert cell
function fit({ data, config }) {
const umap = new UMAP(config);
umap.distanceFn = distance;
return {
result: umap.fit(data)
};
}
Insert cell
res = fit({ data, config })
Insert cell
UMAP = (await require("umap-js@1.3.2")).UMAP
Insert cell
Insert cell
d3 = require("d3@6")
Insert cell
import { slider } from "@jashkenas/inputs"
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