Published
Edited
Feb 18, 2022
9 stars
Also listed in…
Scatter Plots
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mutable point = ({})
Insert cell
dataset = new ScatterGL.Dataset(points)
Insert cell
{
scatterGL.render(dataset);
}
Insert cell
{
scatterGL.startOrbitAnimation();
scatterGL.scatterPlot.orbitCameraControls.rotateSpeed = 20;
scatterGL.scatterPlot.updateOrbitAnimation();
scatterGL.resize();
viewof scatterGL.addEventListener("dblclick", (_) => {
scatterGL.scatterPlot.setCameraPositionAndTarget([1, 1, 1], [0, 0, 0]);
});
}
Insert cell
initialCameraPosition = {
scatterGL.scatterPlot.setCameraPositionAndTarget(
[-1.243287602535262, 0.5241054884089675, 0.21897687150812328],
[-0.2402632441860939, -3.023577104381629e-18, -0.4603422261684601]
);
}
Insert cell
// scatterGL.setSelectMode()
// scatterGL.setPanMode()
Insert cell
// random
points = Array(numPoints)
.fill()
.map(e => {
const rp = Math.random();
const R = rp > p ? rp : 1;
const theta = 2 * Math.PI * Math.random();
const phy = Math.acos(2 * Math.random() - 1);
return [
R * Math.cos(theta) * Math.sin(phy),
R * Math.sin(theta) * Math.sin(phy),
R * Math.cos(phy)
];
})
Insert cell
ScatterGL = {
const { ScatterGL } = await require.alias({
THREE: "three@0.126/build/three.min.js"
})("scatter-gl@0.0.12");
return ScatterGL;
}
Insert cell
import { slider } from "@jashkenas/inputs"
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