Published unlisted
Edited
Apr 7, 2021
1 fork
1 star
Insert cell
Insert cell
Insert cell
viewof containerEl
Insert cell
data = {
const _nrokid = ngrokid.includes("ngrok.io")
? ngrokid.match(/\/\/(.*?)\./)[1]
: ngrokid;
return fetch(`https://${_nrokid}.ngrok.io/data`)
.then(d => d.text())
.then(text => d3.csvParse(text, d3.autoType));
}
Insert cell
init = {
const dataset = new ScatterGL.Dataset(
data.map(p => [p.x, p.y, p.z]),
data.map((d, i) => ({
label: d.digit,
labelIndex: i
}))
);
containerEl.setPointColorer(i =>
convertColor(d3.schemePaired[data[i].digit])
);

containerEl.render(dataset);
containerEl.resize();
}
Insert cell
function convertColor(color) {
const c = d3.color(color);
return (c.b << 16) + (c.g << 8) + c.r * 255;
}
Insert cell
import { viewof containerEl, ScatterGL } with {
points,
labels
} from "@radames/umap-jupyter-notebook-scattergl"
Insert cell
import { Text } from "@observablehq/inputs"
Insert cell
d3 = require("d3-dsv", "d3-scale-chromatic", "d3-color")
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